Questions tagged [error-handling]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
1answer
1k views

Is it possible to make Craft/Twig throw 404 if a template can't be found?

Attempting to include a template that doesn't exist throws HttpStatus 500 – Craft\TemplateLoaderException – Unable to find the template “{template}”. This is usually fine and what you want, but is it ...
4
votes
1answer
2k views

How can I get a full stack trace in my custom plugin log?

I'm using MyPlugin::log to separate the errors for my plugin. However, I'm only able to log a simple message using this technique. Is it possible to have that output the full stack trace? Here's ...
3
votes
1answer
944 views

How to suppress server errors in Craft?

On certain pages of my site, I download and display resized (using the Imager plugin) images from remote site. Now, sometimes that remote site returns error and in such case Imager is throwing ...
3
votes
1answer
102 views

Integrate Bugsnag

What would be a good approach to integrate a service like Bugsnag? Is there some kind of global Error/Exception Handler where everything is routed through and I could hook in? Edit: Find the finished ...
2
votes
3answers
558 views

Error reporting Freeform submission jumps to top of page

When submitting a form with required fields and getting an error, the page jumps to the top, where it should jump to the top of the form. In the standard Craft contact form I can add <form ...
2
votes
2answers
3k views

An exception has been thrown during the rendering of a template ("")

Struggling to debug this one. The full log is as follows: Next exception 'Twig_Error_Runtime' with message 'An exception has been thrown during the rendering of a template ("") in "book/poll-...
2
votes
1answer
688 views

How to catch errors in a service and return to a controller?

How do you handle “catching” errors in a plugin service and return the error to the plugins controller? To be more specific... I am sending an Ajax request to a controller, that controller is ...
2
votes
2answers
191 views

amforms no error handling

I have this form (am forms plugin): {% macro errorList(errors) %} {% if errors %} <ul class="errors"> {% for error in errors %} <li>{{ error }}</li> ...
2
votes
1answer
662 views

Correct way of showing errors when editing profile via front-end form?

I've been looking at the following resources: https://craftcms.com/docs/templating/user-profile-form Allow user to change or delete their photo for their profile from the front end Front end edit: ...
2
votes
0answers
695 views

Does Craft expose PHP errors when not in devMode? [closed]

I'm seeing a lot of tasks hanging in Craft. Specifically, DeleteStaleTemplateCaches and GeneratePendingTransforms. I've followed the advice and instructions at https://craftcms.com/support/stuck-tasks ...
1
vote
3answers
469 views

How to display payment gateway error message only

I am trying to display the error message coming from the payment gateway ONLY. I know I can use {% set message = craft.app.session.getFlash('error') %} {{ message|length ? message }} but commerce ...
1
vote
2answers
81 views

How to receive email notification when an error or bad request happens?

Is it possible to receive email notifications when there is an error or Bad Request issue in Craft CMS? We had an issue where our contact forms were not working due to craft.app.config.general.[...
1
vote
1answer
67 views

Craft internal error exposing sensitive data

I have a craft installation and recently my server had issues and on the page rendering mysql and other errors were shown. Of course this creates security implications. Is there a way to restrict ...
1
vote
1answer
32 views

Basic 404 setup not working

I look at past Q & A about this, but am still perplexed. Not logged in to CP or frontend I have a simple template called 404.twig which resides in the templates folder I can access the template ...
1
vote
1answer
413 views

Error pages in multi site setup

I have a multi site setup for supporting multiple languages in Craft 3. '/' => German '/en/' => English In my general.php I have 'errorTemplatePrefix' => 'error/', When I enter '/...
1
vote
1answer
25 views

What's the best strategy for products that are sold?

I wonder what's best practice for products that are sold? My strategy is to add a lightswitch "sold" and don't display sold products on the website and in the sitemap.xml, in the hopes that ...
1
vote
1answer
129 views

Missing field validation on user account edit

I've been implementing a user account page with Craft Commerce and copied over the template found here: https://docs.craftcms.com/v3/dev/examples/user-profile-form.html#simple-profile The issue is ...
1
vote
1answer
430 views

How do I show errors for a new front end entry form?

I'm using a front end form so logged-in users can create a new entry ("post") or edit an existing entry. Here's the controller for figuring out whether it's a new or existing entry: {# Get the entry ...
1
vote
1answer
6k views

How can I test my 500 error page works

I had a problem with my cloud server and all my sites were generating 500 errors. The response page the visitor saw varied between Craft 2, Craft 3 and ExpressionEngine 2 sites. The Craft 3 ones ...
1
vote
1answer
168 views

Internal Server Error: missing method or closure

Receiving the standard error: Craft\MatrixBlockModel and its behaviors do not have a method or closure named "sectionArticles". The problem is that this error doesn't make sense. Here is why: I ...
1
vote
1answer
272 views

Trouble passing errors back to form through setRouteVariables

This has me a bit stumped. I have two forms - posting to two different actions within the same controller. On error I am attempting to have them both display a flash-notice, as well as pass the model ...
1
vote
1answer
149 views

Setting tab 'error' class for tab with error

When creating an editor interface within my plugin, I am using the following snippet to create a set of tabs inside a tab pane: {% include "_includes/tabs" with { tabA: { label: 'Tab A'|t, url: '#...
1
vote
1answer
1k views

Error sending email: Process could not be started [The system cannot find the path specified. craft cms

I'm testing my email and I'm seeing the following error in the web logs: "Error sending email: Process could not be started [The system cannot find the path specified. craft cms" Does anyone know ...
0
votes
2answers
2k views

Getting image url error code: Impossible to access an attribute ("url") on a null variable

My site just suddenly broke down on a certain page with the following error code, (see screenshot). It is occuring for every image on this page and really confusing me. Any quick suggestions?
0
votes
1answer
468 views

Return to default error handling

In my plugin, I'd like to catch errors when they appear in the control panel, so I can handle them differently. However, from the front-end, I'd like to keep the default Craft-style handling of error ...
0
votes
0answers
125 views

Contact form returning "Error 400: Bad Request: Request missing required param" -- how can I best narrow down the issue?

I'm sort of stumped in troubleshooting the following problem that I'm having with the Contact Form. Below I'll list the code, some of the attributes of the code that may be causing this issue, and the ...
0
votes
1answer
96 views

Multiple dev sites

Running a number of development sites on MAMP Pro and repeatedly receive this alert when attempting to update. Updates are consciously being performed nonsimultaneously, but that does not seem to ...