cranetm / yii2-json-rpc-2.0

Other
26 stars 18 forks source link

Handle exceptions #10

Closed luciuz closed 7 years ago

luciuz commented 7 years ago

Hello!

How to handle all exceptions and send response with json-rpc-2.0 format with code 200? For example, exceptions from the Request?

cranetm commented 7 years ago

try { $classInstance->method1(); $classInstance->method2(); ..... } catch (Exception $e) { throw new \JsonRpc2\Exception('General message', \JsonRpc2\Exception::INTERNAL_ERROR); }