[js] add InvalidArgumentError
This commit is contained in:
parent
9135bc9c88
commit
55b7945dc1
15
shared/apc/index.mjs
Normal file
15
shared/apc/index.mjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { Buffer } from 'buffer';
|
||||||
|
|
||||||
|
export class AsyncProcedureCallEndpoint {
|
||||||
|
/**
|
||||||
|
* Constructs an AsyncProcedureCallEndpoint object.
|
||||||
|
* @param {any} input - stream of data sent by remote.
|
||||||
|
* @param {any} output - stream of data to send to remote.
|
||||||
|
*/
|
||||||
|
constructor(input, output) {
|
||||||
|
this.buf = Buffer();
|
||||||
|
input.ondata = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
11
shared/apc/package.json
Normal file
11
shared/apc/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@og/async-procedure-call",
|
||||||
|
"type": "module",
|
||||||
|
"main": "index.mjs",
|
||||||
|
"dependencies": {
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"@og/error-utils": "file:../error-utils",
|
||||||
|
"@og/uuid": "file:../uuid",
|
||||||
|
"@og/binary-struct": "file:../bstruct"
|
||||||
|
}
|
||||||
|
}
|
@ -9,3 +9,15 @@ export class VirtualMethodNotImplementedError extends Error {
|
|||||||
super('virtual method not implemented.');
|
super('virtual method not implemented.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an error that is thrown when called a function with invalid arguments.
|
||||||
|
* @class
|
||||||
|
* @extends {Error}
|
||||||
|
*/
|
||||||
|
export class InvalidArgumentError extends Error {
|
||||||
|
/** @constructor */
|
||||||
|
constructor(name, reason) {
|
||||||
|
super(`argument ${name} is invalid: ${reason}.`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user