I am currently trying to get the error code from a Video.js error. I know how to get the error Message but I can't figure out how to get the numeric code for the error.
According to the documentation for MediaError there is a status property which is an array (at the bottom of the page). So it could contain multiple codes.
status: Array
An optional status code that can be set by plugins to allow even more detail about the error. For example a plugin might provide a specific HTTP status code and an error message for that code. Then when the plugin gets that error this class will know how to display an error message for it. This allows a custom message to show up on the Player error overlay.
So there's no guarantee there will even be a status code, the status array could be empty. However, you can check the length of the array to see if there are entries, then loop over them looking to see if they contain the status code(s) you're concerned with.
Related
I have a few test steps set up in SOAPUI with a property transfer step in between to transfer the sessionkey from one response to the next. The problem is, that the response is putting "" around the session key, and these need to be removed in the property transfer.
I used to have a working script that did just that:
def response = messageExchange.responseContent
response = response.replace("""","")
messageExchange.modelItem.testStep.testCase.setPropertyValue("jsonResponse",response)
However, this is no longer working and gives the following error: "Content not allowed in prolog".
Has anyone got any idea what causes this? It was working fine, but after having used SOAPUI for a few years, its now throwing this error..
Thanks!
I use several JS files that I don't have access to and write all over my console.
But I only want to display my own message with console.log("Own message.") and errors (e.g. 404 error).
If I use console.clear before the log function, directly but also all error messages are cleared.
Is there a way to filter console messages to show only errors or the own message and errors?
I have already heard that there are certain libraries for this.
Is it also possible without?
In Chrome, you can just type in the name of your JavaScript file to filter for messages that only come from that file. For example, I had some console messages, and then I typed in userscript to only display logs that came from userscript.html:
Firefox has the same sort of filtering box too.
No need for any libraries.
To display messages from multiple multiple possible sources but no others (for example, to show only messages from foo and bar), use a regular expression, eg:
/foo|bar/
in the same filter box.
The Firefox web console (showing Javascript console.log messages) has a search box allowing to 'filter' messages. This is useful to find if a certain message 'foo' has been shown on console, but filtering hides all the other messages on console, so it is not possible to see exactly when 'foo' has been logged.
I would want to 'search' among console messages in order to debug js scripts, to see when a message has been logged and check previous and following messages.
I've searched a lot, but it seems like this feature is not there. There is a way to achieve this result with the native console or some plugin console having this feature?
As you requested, I'll convert my comment to an answer, but leave the comment as is (so people will not be confused).
There is no feature available that allows you to filter for a message and show the last x messages not fitting the criteria. You could, however, enable the timestamp for log messages (top right corner, the settings icon, enable timestamp). Filter your messages, look up the timestamp and remove the filter. I'd suggest using the debugger though.
I have a script that queries a local PHP file by creating an XMLHttpRequest. Sometimes the PHP file returns nothing and thus an error is thrown saying:
XML Parsing Error: no root element found
Location: <URL of page>
Line Number 1, Column 1:
^
How can I catch this error so I can display a message saying something like, "No Results"?
This may be irrelevant for this question, but extra information probably won't hurt. I am using the Amazon Product Advertising API, and I only get this error when there are spaces in the keywords, even though I urlencode the keywords properly. It works fine if I only have one word, but not if there are multiple for some reason. Not quite sure what the issue is there, but I still would like to be able to catch these errors in a user friendly way.
I have an asp.net control that contains a grid view sitting on top of an Ajax update panel. The control has been added to a sharepoint page. When a button is clicked, some server code is called to store the contents of the grid.
If the server code throws an error, I want to spit out a javascript alert displaying the error message, but for some reason the error that bubbles up from the server is the generic 500 server error, which doesn't contain any details of the original error.
Can anyone explain why this is?
Many thanks
Gerry
The default behaviour of ASP.NET (and SharePoint) is to display a generic error page when an exception is thrown. For security reasons, this page hides all details of the error. With debug settings in web.config you can get a stack trace, but that won't give you something easily manipulated in javascript.
To return a custom error page you can either set up a global unhandled exception handler (probably overkill for this) or you can catch the exception and modify the response appropriately. For a rest method you would clear the response, set status to 500 and write the error message to the response. For an UpdatePanel, you would render the panel as an error message or with script to show the alert. Not sure if you would set status in this case - UpdatePanel is an ugly hack to fake true ajax in webforms, so you can't expect the code to be particularly clean.