-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathprivilegeError.js
47 lines (42 loc) · 1.21 KB
/
privilegeError.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// @ts-check
import * as base from '../utils/base.js'
export const command = 'privilegeError [guid]'
export const aliases = ['pe', 'privilegeerror', 'privilegerror', 'getInsuffficientPrivilegeErrorDetails']
export const describe = base.bundle.getText("privilegeError")
export const builder = base.getBuilder({
guid: {
alias: ['g', 'error'],
type: 'string',
desc: base.bundle.getText("errorGuid")
}
})
export function handler (argv) {
base.promptHandler(argv, dbCall, {
guid: {
description: base.bundle.getText("errorGuid"),
type: 'string',
required: true
}
})
}
export async function dbCall(prompts) {
base.debug('dbCall')
try {
base.setPrompts(prompts)
const db = await base.createDBConnection()
let inputParams = {
GUID: prompts.guid
}
base.debug(inputParams)
let sp = await db.loadProcedurePromisified("SYS", "GET_INSUFFICIENT_PRIVILEGE_ERROR_DETAILS")
let object = await db.callProcedurePromisified(sp, inputParams)
if (object.results < 1) {
throw new Error(base.bundle.getText("errGUID"))
}
base.outputTableFancy(object.results[0])
base.end()
return object.results[0]
} catch (error) {
base.error(error)
}
}