Skip to content

Wrong location for certain errors #2852

Open
@mattjohnsonpint

Description

@mattjohnsonpint

Bug description

For certain common errors, such as accessing an array index that is out of bounds, the error message returned shows the location of the error in the standard library rather than the location of the code that caused the error.

Steps to reproduce

Consider this user code, in a file at /assembly/index.ts:

export function test(): i32 {
  const a: i32[] = [0, 1, 2];
  const i = a[3]; // error should occur here
  return i;
}

When invoked by the host, the error given is:

abort: Index out of range in ~lib/array.ts(114:42)

Which is here, but IMHO not very useful.

I would expect:

abort: Index out of range in index.ts(3:15)

AssemblyScript version

v0.27.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions