Opencart Ajax Error unexpected token < - ajax

I'm using OpenCart 1.5.1.3 and having this strange error on Guest Shipping in Ajax. I'm getting the error "Unexpected token <".
I have tried everyting, change the Ajax code, look at the controller, but no luck. You can try it yourself at http://www.biancabonte.nl/shop/. Put something in the cart and checkout Direct instead of registering. Then the problem occurs.
Thanks

This is almost certainly due to an error message being output by your store, which precedes the AJAX JSON content. Check your error logs around the time you made/make the request. While they won't contain the < character since they're not formatted like the ones output by PHP, they will still have the actual message. Your error logs will either be in the SYSTEM > ERROR LOGS in the admin, or in your cpanel/plesk/other control panel under logs usually

Related

Prevent "success message checksum content error" when a session is invalid?

I've got an error message that crops up in my logs pretty often, "Success message checksum content error" with an error code of apex.success_msg.checksum_content_error. I'm pretty sure I know exactly what's happening, basically:
User loads page 1, which contains a list of things that can be edited
User clicks a link to page 2, which allows them to edit the thing
Clicking Save Changes redirects them back to page 1 with a success message, "Changes to the thing have been saved."
User bookmarks the version of page 1 with the success message encoded in the URL, like "...&success_msg=..."
Tomorrow, user uses this bookmark, but their session has expired, so the success message is no longer valid and they get an error.
Is there anything I can do in Apex to prevent this from happening? I can go to each user that does this and tell them, "Don't bookmark that, bookmark this other URL instead", but I'd rather prevent the problem from happening at all.
About the only thing that comes to mind is a custom error handler that looks for this particular error and redirects to a version of the URL without the &success_msg in it, but I'm not even sure if you can redirect inside an error handler like that.

site - is currently unable to handle this request Http error 500

once i clicked on "Proceed to checkout" button, we are getting below error
The sitename.com is't working
www.sitename.co.nz is currently unable to handle this request
Http Error 500
even in backend when we open some orders, than also same error in order-view page.
we have shared hosting.
It was a problem with magento core file cc.php file , one of our devoloper edited it in wrong way, once i replaced the
original file, it worked fine.

Classic ASP Error Handling: Calling a function after an error?

I do maintenance on a classic ASP website that basically has no error handling at all yet. So users see any error message that comes across... Instead, I would like my code to be able to catch any potential error and then fire off an email before redirecting the user to a more friendly error-page.
This website is rather large, and every webpage comes with the same include file at the beginning... So ideally, I would like to set an error handler from the beginning of this include file. I haven't had any luck finding a way to do this without having to go through every page individually having error handling happen at the end of the script... Is there a possible way to code something like this from the include file?:
' Include file contents:
Function MyHandler()
'Code for triggering email goes here
response.redirect "ErrorPage.asp"
End Function
On Error call MyHandler()
Thanks in advance!
I suggest to use Custom Error Pages in IIS (Web Server), if you have access to those. You can redirect different types of errors to different scripts if you like or point them all to a single one and have there the logic for all error codes.
You can catch common errors there and maybe redirect the user to a alternative page/site, or return a specific error message.. I would suggest to use the custom error page also to log the error and some information from the session (e.g. form submit data, query strings, referrer URLs, cookies etc.) in a database and/or send a notification email to some service account to identify specific issues that are occurring and then also have something to go on to actually fix the cause of many of the errors.

Custom error handling

I am developing a component in joomla 2.5, my component sends a request to some url and gets the response object. If i pass wrong url, joomla takes me to the default page of Error : 500 - No response code found . I want that if user install my component and mistakenly they put wrong url , it should show some custom error message/page which should more meaningful to non-programming person rather than taking user to default error page. Is there some way to add this type of functionality in Joomla without editing template/error.php file in core.
You should have an error.php file in your template, if you don't add one and make it look the way you want. also remember that when you turn debugging off you won't get the stack trace etc.
However error 500 indicates something different than that the url does not exist ("wrong URL"), which would be a 404. 500 is an internal server error and you need to check your logs to figure out what is causing it.

Codeigniter global error override

Is there a way in Codeigniter to override global errors. For instance if an DB error or PHP critical occurs it wont show the error itself but something like 'Our admin guy is fixing the issue' and the error is just logged and emailed.
Codeigniter lets you handle error messages your way, depending on the HTTP status.
Refer to this documentation on error handling
In addition to #Pos5e5s3dFr3ak's answer, you should handle as many errors as you can manually. For example, if you have a database error, your code should acknowledge (or 'catch') it and perhaps load the appropriate view, or pass it onto a library that will log an email the fault, instead of displaying the intended result.
This method can be used as an alternative, or as an addition to the original answer - sometimes you need not locate the error just by its HTTP response Status Code.
As an example, you may find that the database engine in use is down. If this is the case (you would have to determine if it is indeed down - ie. you are not getting the desired response), you would pass the user on to example.com/error/database, for example.

Resources