Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiac committed Nov 23, 2023
2 parents 3a43c9b + 2f7352c commit b5fae90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ruts",
"version": "0.11.2",
"version": "0.12.0",
"type": "module",
"description": "Type-safe error-handling library for TypeScript",
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions src/result_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export abstract class ResultError<T extends Error | null = null> implements Erro
readonly stack?: string
readonly origin: T | null

constructor(message?: string, origin?: T) {
this.message = message ?? ""
this.origin = origin ?? null
constructor(args: {message?: string; origin?: T} = {}) {
this.message = args.message ?? ""
this.origin = args.origin ?? null

if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor)
Expand Down Expand Up @@ -51,7 +51,7 @@ export class StdError<T = unknown> extends ResultError<Error> {
origin instanceof Error
? origin
: new TypeError(`Unexpected error type: "${String(origin)}"`)
super(message)
super({message})
this.origin = o
this.originRaw = origin
}
Expand Down
2 changes: 1 addition & 1 deletion test/result_error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe.concurrent("ResultError", () => {
readonly tag = MyResultError._tag

constructor(message?: string, origin?: Error) {
super(message, origin)
super({message, origin})
}
}

Expand Down

0 comments on commit b5fae90

Please sign in to comment.