[add] first

This commit is contained in:
2022-04-29 15:25:10 +08:00
commit da8024fc30
87 changed files with 16892 additions and 0 deletions

21
test/api/a/b/c/ApiTest.ts Normal file
View File

@@ -0,0 +1,21 @@
import { TsrpcError } from "tsrpc-proto";
export async function ApiTest(call: any) {
if (call.req.name === 'InnerError') {
throw new Error('a/b/c/Test InnerError')
}
else if (call.req.name === 'TsrpcError') {
throw new TsrpcError('a/b/c/Test TsrpcError', {
code: 'CODE_TEST',
info: 'ErrInfo a/b/c/Test'
});
}
else if (call.req.name === 'error') {
call.error('Got an error')
}
else {
call.succ({
reply: 'a/b/c/Test reply: ' + call.req.name
})
}
}