opral / inlang-message-sdk

0 stars 0 forks source link

Expose Error types that are part of the External API #99

Closed LorisSigrist closed 1 week ago

LorisSigrist commented 1 week ago

Context

project.errors() returns a union of a bunch of different errors, that may have one of many prototypes. However, when you get an error it's impossible to react to which error it is exactly since you cant access the prototypes to do type-checks.

Eg:

for(const error of project.errors()) {
  //apps can't do this because ModuleError is not exported
  if(error instanceof ModuleError) console.warn("Error in", error.module)
}

Proposal

Expose the Error types that are part of the External API

samuelstroschein commented 1 week ago

CleanShot 2024-06-18 at 11.48.10@2x.png

true. should likely be export * from "./errors.js

@loris.sigrist would it be good to speed up iterations on the inlang sdk by submitting prs for small issues like this instead of opening one?