File tree 1 file changed +10
-1
lines changed
pkg/cmd-api-server/src/main/typescript/cmd
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
11
11
} from "@dci-lint/core-api" ;
12
12
13
13
import { launchApiServerApp } from "./dci-lint-server" ;
14
+ import { RuntimeError } from "run-time-error" ;
14
15
15
16
const log : Logger = LoggerProvider . getOrCreate ( {
16
17
label : "api" ,
@@ -55,7 +56,15 @@ export async function launchCliApp(): Promise<void> {
55
56
} ,
56
57
async ( args : any ) => {
57
58
log . info ( `Parsing request JSON: ${ args . request } ` ) ;
58
- const req = JSON . parse ( args . request ) as LintGitRepoRequest ;
59
+ let req : LintGitRepoRequest ;
60
+ try {
61
+ req = JSON . parse ( args . request ) as LintGitRepoRequest ;
62
+ } catch ( ex ) {
63
+ throw new RuntimeError (
64
+ `Failed to parse JSON request from CLI: ${ args . request } ` ,
65
+ ex
66
+ ) ;
67
+ }
59
68
const res = await main ( req ) ;
60
69
if ( args . pretty ) {
61
70
// tslint:disable-next-line: no-console
You can’t perform that action at this time.
0 commit comments