Skip to content

Instantly share code, notes, and snippets.

@willianantunes
Created August 11, 2018 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willianantunes/060d3794d5ddb6496b96c45ea8cb727a to your computer and use it in GitHub Desktop.
Save willianantunes/060d3794d5ddb6496b96c45ea8cb727a to your computer and use it in GitHub Desktop.
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