Comments (3)
I've added a friendlier notifications to the Annotator class (perhaps it should reside in a separate object?) and added some error messages for various response statuses.
However it's looking like the XMLHTTPRequest
object is not updated in either WebKit or Firefox if the request is not successful. This results in a status code of 0
(which jQuery normalises to 302
).
Example
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:5000/annotations/21', true);
xhr.onreadystatechange = function () {
console.log("%o %o", xhr.status, xhr.responseText, xhr)
};
xhr.send();
So unless anyone has any thoughts? It looks like we're only able to provide very generic error messages, which is a shame.
from annotator.
Another option that may be worth considering is to detect the Annotator (using a custom HTTP header) and then always return a successful response but override the status in a similar way to method overloading in web frameworks.
For example an invalid authorisation would return
HTTP/1.1 200 OK
X-HTTP-Status-Override: 401 Unauthorized
Although this may not be worth the effort involved in updating the store.
from annotator.
Closing this ticket. CORS error handling may need to be ticketed for improvement at a later date.
Current state is that Annotation.showNotification() displays a message fixed to the top of the users screen with the current error message. The notification can be removed on click or will hide itself after five seconds.
Generic error messages are:
"Sorry we could not #{action} the annotations from the store"
if the request affects more than one annotation and
"Sorry we could not #{action} this annotation"
where it affects just one. #{action} will be replaced with the current action eg. read, update, delete etc.
When we get a definite status from the server:
401 Unauthorised: "Sorry you are not allowed to #{action} this annotation"
404 Not Found: "Sorry we could not connect to the annotations store"
500 Internal Server Error: "Sorry something went wrong with the annotation store"
In future it would be useful to return more specific errors from the annotation store.
from annotator.
Related Issues (20)
- 1.2.10 "annotationCreated", function (annotation) returns a annotation object with functions HOT 3
- Dynamic content. How to update ranges?
- Does anyone else have a problem with deleting/updating an annotation? HOT 4
- Is it possible to remove loaded annotations in 2. HOT 1
- Which search key is used? HOT 1
- Documentation for stable/1.2x missing ? HOT 3
- jQuery data is visible only in some stack frames HOT 1
- adjust the z-index
- How to save annotations with store plugin? HOT 20
- Does not display annotations in a pdf document. HOT 2
- viewer: new annotations for the same word
- Store plugin: how to send variable values in annotationData HOT 6
- Unable to console.log store pluggin output getting following error ---- Could not load Tags plugin. Have you included the appropriate <script> tag?
- Uncaught TypeError: Cannot read property 'nodeType' of undefined
- Uncaught TypeError: Cannot read property 'hide' of null
- active forks HOT 2
- Sorry, I don't know how to display the saved data to the page
- Page loading two times when i added annotations to body tag
- i cannot see highlight tags on screen when i loaded annotators (json format)
- this doesn't work.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from annotator.