UNPKG

@har-sdk/core

Version:

The base package can be used to import specification files (i.e. HAR, OAS and Postman Collection) and detect their type.

25 lines 720 B
export class BaseLoader { constructor(syntaxErrorDetailsExtractor) { this.syntaxErrorDetailsExtractor = syntaxErrorDetailsExtractor; } load(source) { this.source = source; this.error = undefined; try { return this.parse(); } catch (e) { if (e instanceof Error) { this.error = e; } throw e; } } getSyntaxErrorDetails() { return (this.error && (this.isSupportedError(this.error) ? this.syntaxErrorDetailsExtractor.extract(this.error, this.source) : { message: this.error.message })); } } //# sourceMappingURL=BaseLoader.js.map