Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
elin.angelov
committed
Mar 9, 2018
1 parent
3387ddb
commit 4de52fb
Showing
3 changed files
with
33 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
const errorList = Object.keys(require('./list.json')); | ||
const messages = Object.keys(require('../messages.json')); | ||
const defineError = require('ut-error').define; | ||
const Payshield = defineError('payshield'); | ||
const Parser = defineError('parser', Payshield, 'parser error'); | ||
|
||
var errors = { | ||
parser: Parser, | ||
unableMatchingHeaderPattern: defineError('unableMatchingHeaderPattern', Payshield, 'Unable to match header to header pattern!'), | ||
unknownResponseCode: defineError('unknownResponseCode', Payshield, 'Unknown response code'), | ||
notimplemented: defineError('notimplemented', Payshield, 'Not implemented'), | ||
unableMatchingResponseCode: defineError('unableMatchingResponseCode', Payshield, 'Unable to match response errorCode!'), | ||
unableMatchingPattern: defineError('unableMatchingPattern', Payshield, 'Unable to match pattern') | ||
module.exports = (defineError) => { | ||
const Payshield = defineError('payshield'); | ||
const Parser = defineError('parser', Payshield, 'parser error'); | ||
|
||
}; | ||
|
||
errors = messages.reduce((a1, c1) => { | ||
const MsgErr = defineError(c1, Payshield, `Error in method: ${c1}`); | ||
return errorList.reduce((a2, c2) => { | ||
var Err = defineError(c2, MsgErr, errorList[c2]); | ||
a2[`${c1}.${c2}`] = (cause) => (new Err(cause)); | ||
return a2; | ||
}, a1); | ||
}, errors); | ||
var errors = { | ||
parser: Parser, | ||
unableMatchingHeaderPattern: defineError('unableMatchingHeaderPattern', Payshield, 'Unable to match header to header pattern!'), | ||
unknownResponseCode: defineError('unknownResponseCode', Payshield, 'Unknown response code'), | ||
notimplemented: defineError('notimplemented', Payshield, 'Not implemented'), | ||
unableMatchingResponseCode: defineError('unableMatchingResponseCode', Payshield, 'Unable to match response errorCode!'), | ||
unableMatchingPattern: defineError('unableMatchingPattern', Payshield, 'Unable to match pattern') | ||
}; | ||
|
||
module.exports = errors; | ||
return messages.reduce((a1, c1) => { | ||
const MsgErr = defineError(c1, Payshield, `Error in method: ${c1}`); | ||
return errorList.reduce((a2, c2) => { | ||
var Err = defineError(c2, MsgErr, errorList[c2]); | ||
a2[`${c1}.${c2}`] = (cause) => (new Err(cause)); | ||
return a2; | ||
}, a1); | ||
}, errors); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters