fix: replace generic Error with OperationError in Thrift serialization and deserialization operations
This commit is contained in:
parent
294f597393
commit
064d625954
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import {
|
||||
parseBinaryProtocol,
|
||||
parseCompactProtocol
|
||||
@ -56,7 +57,7 @@ class ThriftDeserialize extends Operation {
|
||||
}
|
||||
return JSON.stringify(decodedObject, null, 4);
|
||||
} catch (err) {
|
||||
return `Error decoding Thrift payload: ${err.message}\n\nPartial output:\n${JSON.stringify(decodedObject, null, 4)}`;
|
||||
throw new OperationError(`Error decoding Thrift payload: ${err.message}\n\nPartial output:\n${JSON.stringify(decodedObject, null, 4)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import {
|
||||
buildBinaryStruct
|
||||
} from "../lib/Thrift.mjs";
|
||||
@ -42,7 +43,7 @@ class ThriftSerialize extends Operation {
|
||||
try {
|
||||
parsedInput = JSON.parse(input);
|
||||
} catch (e) {
|
||||
throw new Error("Input must be valid JSON.");
|
||||
throw new OperationError("Input must be valid JSON.");
|
||||
}
|
||||
|
||||
const bytes = [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user