-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Any23 as extraction service #3
Comments
jetschni
changed the title
Adding Any23 as extraction service
Add Any23 as extraction service
Mar 15, 2017
This was referenced Mar 28, 2017
Example fail(function (jqXHR, exception) {
// Our error logic here
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
}
//Any23 Error Reporting
else if (jqXHR.status == 400) {
msg = 'Bad Request: Missing or malformed input parameter.';
} else if (jqXHR.status == 404) {
msg = 'Not Found: Malformed request IRI.';
} else if (jqXHR.status == 406) {
msg = 'Not Acceptable: None of the media types specified in the Accept header are supported.';
} else if (jqXHR.status == 415) {
msg = 'Unsupported Media Type: Document body with unsupported media type was POSTed.';
} else if (jqXHR.status == 501) {
msg = 'Not Implemented: Extraction from input was successful, but yielded zero triples.';
} else if (jqXHR.status == 502) {
msg = 'Bad Gateway: Input document from a remote server could not be fetched or parsed.';
var errorReporting = $.parseXML( responseText);
try {
responseText = jqXHR.responseText
var errorReporting = $.parseXML( responseText);
}
catch(err) {
//console.log(err);
var responseText = jqXHR.responseText + '</issueReport></report>';
var errorReporting = $.parseXML( responseText);
}
var message = $(errorReporting).find( "message").text();
var errorRaw = $(errorReporting).find( "error").text();
var rx = /([A-Z]+):[ \t]+'(.+)'/g;
var error;
while (error = rx.exec(errorRaw)) {
var errorCode = error[1];
var errorMessage = error[2];
if (errorCode == 'WARNING') {
cssClass = 'text-warning';
icon = 'warning';
}
else if (errorCode = 'ERROR') {
cssClass = 'text-danger';
icon = 'error';
}
else {
errorCode = 'Undefined error'
icon = 'error_outline';
}
$("#errorMessage > .list-group").append('<li class="list-group-item"><i class="material-icons ' + cssClass + '">' + icon + '</i> <strong>' + errorCode + ':</strong> ' + errorMessage + '</li>');
}
if(errorCode){
$("#errorMessage").show();
}
}
else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example implementation see
https://github.com/EduGraph/EduGraph-Preview/blob/dev-php-implementation/assets/js/any23.js
The text was updated successfully, but these errors were encountered: