Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 4d65bd8

Browse files
committed
fix(ipc): fix error prop asignment in 'maybeMakeError'
1 parent 4186642 commit 4d65bd8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

ipc.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ function maybeMakeError (error, caller) {
101101
}
102102

103103
// assign extra data to `err` like an error `code`
104-
Object.assign(err, error)
104+
for (const key in error) {
105+
try {
106+
err[key] = error[key]
107+
} catch (err) {
108+
void err
109+
}
110+
}
105111

106112
if (
107113
typeof Error.captureStackTrace === 'function' &&
@@ -202,7 +208,7 @@ export class Result {
202208
const err = maybeMakeError(result?.err, Result.from)
203209
const data = result?.data !== null && result?.data !== undefined
204210
? result.data
205-
: result?.err ? null : result
211+
: (result?.err ? null : result)
206212

207213
return new this(data, err)
208214
}
@@ -233,7 +239,11 @@ export class Result {
233239
get length () {
234240
if (this.data !== null && this.err !== null) {
235241
return 2
242+
} else if (this.data !== null || this.err !== null) {
243+
return 1
236244
}
245+
246+
return 0
237247
}
238248

239249
*[Symbol.iterator]() {

test/ssc.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ maintainer: Socket Supply Co.
2424
bundle_identifier: co.socketsupply.io.tests
2525
bundle_identifier_short: co.socketsupply.io.tests
2626

27-
forward_console: true
27+
# forward_console: true
2828

2929
headless: true

0 commit comments

Comments
 (0)