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.
Related
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 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.
I have client script that calls nlapiLoadRecord and puts it in a variable
var z = nlapiLoadRecord("test", 881)
It is inside a field changed function that will be put in an online form.
But whenever I try to trigger it it shows this:
Network Error Failed alert box.
Not having a type or id will throw the normal error messages but having them both will trigger the error above.
You probably cannot do this like you are thinking. Netsuite does not generally allow online form users to load records directly. For an online form what I normally do is create a suitelet that can return the custom record's info as JSON. If you are trying to access a custom record you can try going to the custom record and setting its access to use a permissions list then give the "Online Form User" read permissions for the record. This may work and is likely ok as long as you only plan to use the custom record as a lookup.
In general for this the usual suspects are:
Does the user you are running as have the custom lists permission? That's pretty unlikely given that you are calling this from an online form.
Use a real record id. A custom record id will begin with "customrecord" and may be found under Customization -> Lists, Records, Fields -> Record Types. Native record ids may be found through the help but I find it useful to bookmark the latest release
When adding more than 20 attachments to a contact form file input; PHP returns the following message:
Warning: Maximum number of allowable file uploads has been exceeded in Unknown on line 0
I can't replace this message with my own because it happens before my PHP script executes. Although If I get the returned warning and parse it with JavaScript, I can replace it with my own simpler warning message. Is there such a library that does this sort of thing with many warning and error messages that can't be changed with PHP?
You have to increase the max_file_uploads setting in php.ini, there is no way around it, if you want to use the code you have.
Or do something different, like submit the files in separate requests using AJAX.
Instead of styling the error message generated by PHP, you want to prevent it ever getting to that point. You need to implement validation before your AJAX gets submitted, so if your server only allows x file uploads at one time do:
Jquery:
if($("input:file")[0].files.length>x) {
// perform your ajax request
} else {
// show your error message
}
Javascript applications are growing day by day and getting complex too.
so is there possible to handle uncatched error that occured in app so they can be send back to server for further analysis.
i just see in phpmyadmin app sometimes show a little popup in bottom say that javascript error occurred would you like to send to server.
I am not asking about try catch or block level error handling instead i want to know weather is it possible to handle global errors just like any browser show in console/log areas. if yes then how.
Ohh sorry.. got answers
Logging Clientside JavaScript Errors on Server
The HTML onerror event may be what you want.