Created
June 22, 2019 07:21
-
-
Save ikr4-m/897912539f367b93cfd7fda4681733f1 to your computer and use it in GitHub Desktop.
Get JSON file in CI_RESTful_Error_Exception
This file contains hidden or 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
/** | |
* @param {string} err | |
*/ | |
let getErrorMessage = (err) => { | |
// All json string will pass in this regex | |
let regex = /(\{\"([^\"]+)\"\:(\w+)\,\"([^\"]+)\"\:\"([^\"]+)\"\,\"([^\"]+)\"\:\"([^\"]+)\"\})/gm | |
return JSON.parse(err.match(regex)[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment