-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: overwrites error constructors and helpers for locally imported k…
…po instances
- Loading branch information
Showing
15 changed files
with
54 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './public'; | ||
export { default as core } from './core'; | ||
export { default as errors } from './utils/errors'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { options as _options } from '~/core'; | ||
import { IScopeOptions } from '~/types'; | ||
import { wrap } from '~/utils/errors'; | ||
import errors from '~/utils/errors'; | ||
|
||
/** | ||
* Programmatically sets *kpo* options. | ||
*/ | ||
export default function options(opts: IScopeOptions): void { | ||
return wrap.throws(() => _options.setScope(opts)); | ||
return errors.wrap.throws(() => _options.setScope(opts)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
import { scope, Errorish } from 'errorish'; | ||
|
||
export class CustomError<T> extends Errorish<T> {} | ||
// Error changes might constitute major version changes even if internal, | ||
// as they're overwritten for different kpo instances on load (requireLocal) | ||
|
||
export class OpenError<T> extends CustomError<T> { | ||
class CustomError<T> extends Errorish<T> {} | ||
|
||
class OpenError<T> extends CustomError<T> { | ||
public get name(): string { | ||
return 'OpenError'; | ||
} | ||
} | ||
|
||
export class WrappedError<T> extends CustomError<T> { | ||
class WrappedError<T> extends CustomError<T> { | ||
public get name(): string { | ||
return 'WrappedError'; | ||
} | ||
} | ||
|
||
export const open = scope.set('_kpo_open_', { | ||
const open = scope.set('_kpo_open_', { | ||
Error: CustomError, | ||
Errorish: OpenError | ||
}); | ||
|
||
export const wrap = scope.set('_kpo_wrap_', { | ||
const wrap = scope.set('_kpo_wrap_', { | ||
Error: CustomError, | ||
Errorish: WrappedError | ||
}); | ||
|
||
export default { | ||
CustomError, | ||
OpenError, | ||
WrappedError, | ||
open, | ||
wrap | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters