Created
August 11, 2018 13:46
-
-
Save willianantunes/060d3794d5ddb6496b96c45ea8cb727a to your computer and use it in GitHub Desktop.
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
class SampleJasmineService { | |
constructor(serviceUrl) { | |
this._http = new HttpService(); | |
this._servicoUrl = serviceUrl; | |
} | |
consult(message) { | |
return this._http | |
.post(this._servicoUrl + '?sampleJasmine=' + message) | |
.then(result => result) | |
.catch(errorDetails => { | |
let error; | |
try { | |
error = JSON.parse(errorDetails); | |
} catch (e) { | |
throw new Error('Não foi possível concluir a operação honesta, favor debug!'); | |
} | |
throw new Error(error.message); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment