Skip to content

Compiler swallows Errors thrown in CompilerPasses #208

@fcaps

Description

@fcaps

Hey,

don't know if this was by mistake, but the Compiler is swallowing all Errors other than RangeError, took me a while to debug this.

  async run () {
    try {
      if (!this._container.frozen) {
        await this._loadExtensions()
        await this._optimize()
        await this._remove()
      }
    } catch (error) {
      if (error instanceof RangeError) {
        throw new ServiceCircularReferenceException()
      }
    }
  }

the original compile from was re-throwing:

  compile () {
    try {
      if (!this.frozen) {
        this._loadExtensions()
        this._optimize()
        this._remove()
      }
    } catch (error) {
      if (error instanceof RangeError) {
        throw new ServiceCircularReferenceException()
      }

      throw error
    }
  }

looking at the code, compiling a frozen container should also thrown an Error imo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions