mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-22 04:11:34 +00:00
Update JS SDK API to the new version (#61)
* FluenceClient renamed to FluencePeer. * Using Aqua compiler is now the recommended way for all interaction with the network, including services registration and sending requests * Old API (sendParticle etc) has been removed * Opaque seed format replaced with 32 byte ed25519 private key. KeyPair introduced * Documentation update
This commit is contained in:
14
src/internal/defaultMiddlewares.ts
Normal file
14
src/internal/defaultMiddlewares.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { CallServiceArg, CallServiceData, CallServiceResult, Middleware, ResultCodes } from './CallServiceHandler';
|
||||
|
||||
/**
|
||||
* Error catching middleware
|
||||
*/
|
||||
export const errorHandler: Middleware = (req: CallServiceData, resp: CallServiceResult, next: Function): void => {
|
||||
try {
|
||||
next();
|
||||
} catch (e) {
|
||||
resp.retCode = ResultCodes.exceptionInHandler;
|
||||
resp.result = `Handler failed. fnName="${req.fnName}" serviceId="${req.serviceId}" error: ${e.toString()}`;
|
||||
}
|
||||
};
|
||||
1;
|
Reference in New Issue
Block a user