@@ -3,7 +3,7 @@ import { Buffer } from "node:buffer";
33import http , { type ClientRequest , type IncomingMessage } from "node:http" ;
44import https from "node:https" ;
55import { generateSecureUuid } from "openclaw/plugin-sdk/core" ;
6- import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime" ;
6+ import { formatErrorMessage , toErrorObject } from "openclaw/plugin-sdk/error-runtime" ;
77import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime" ;
88
99export type SignalRpcOptions = {
@@ -145,7 +145,7 @@ function requestSignalHttpText(
145145 }
146146 settled = true ;
147147 cleanup ( ) ;
148- reject ( toLintErrorObject ( error , "Non-Error rejection" ) ) ;
148+ reject ( toErrorObject ( error , "Non-Error rejection" ) ) ;
149149 } ;
150150 const resolveOnce = ( response : SignalHttpResponse ) => {
151151 if ( settled ) {
@@ -297,7 +297,7 @@ function openSignalEventStream(
297297 }
298298 settled = true ;
299299 cleanup ( ) ;
300- reject ( toLintErrorObject ( error , "Non-Error rejection" ) ) ;
300+ reject ( toErrorObject ( error , "Non-Error rejection" ) ) ;
301301 } ;
302302 const request : ClientRequest = client . request (
303303 url ,
@@ -441,17 +441,3 @@ export async function streamSignalEvents(params: {
441441
442442 await flushEvent ( ) ;
443443}
444-
445- function toLintErrorObject ( value : unknown , fallbackMessage : string ) : Error {
446- if ( value instanceof Error ) {
447- return value ;
448- }
449- if ( typeof value === "string" ) {
450- return new Error ( value ) ;
451- }
452- const error = new Error ( fallbackMessage , { cause : value } ) ;
453- if ( ( typeof value === "object" && value !== null ) || typeof value === "function" ) {
454- Object . assign ( error , value ) ;
455- }
456- return error ;
457- }
0 commit comments