question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: A way to remove errors without rolling back

See original GitHub issue

In our form component and app we have a concept of non_field_errors which get returned from the api (default django-rest-framework behavior). These errors are “form-level” and not tied to a specific field.

To keep things simple we use our changeset form to display these if they occur by doing something like:

        try {
            yield bankcard.save();
        } catch (err) {
            err.errors.forEach(({ attribute, message }) => {
                changeset.pushErrors(attribute, message[0]);
            });
            return undefined;
        }

which if err === non_field_errors, our form template will render at the top of the form like:

    {{cool-form/error changeset "non_field_errors"}}

The problem is if a user submits and receives a non_field_error, we have to then handle clearing just that one specific error before they can submit again. While this is easy to do, to delete just that specific error with no related input attached we have to do delete changeset._errors.non_field_errors

Proposal: Can we add a public interface to remove a single error without relying on private properties?

e.g. changeset.removeError('non_field_errors') or changeset.clearError('non_field_errors')

OR just a public way to clear all errors e.g. changeset.clearErrors() without rolling the form back

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
snewcomercommented, Aug 7, 2018

I’ll try to get this one done this week…

1reaction
nucleartidecommented, Feb 5, 2018

Thanks for the detailed writeup @erichonkanen, this sounds reasonable to me.

My only concern is that I don’t remember (off the top of my head) if changes and errors are mutually exclusive. Here’s what I mean:

const c = new Changeset(...);
c.set('phoneNumber', '123-123-1234'); // valid, internal changes map has 'phoneNumber'
c.set('phoneNumber', 'asdfhjkl'); // invalid, internal errors map has 'phoneNumber'
// but does the internal changes map still have 'phoneNumber'?

If changes and errors are mutually exclusive, then feel free to open a PR for this! Maybe something like changeset.rollback({ onlyErrors: true });?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ensuring rollback safety during deployments - Amazon AWS
My focus is on how to ensure that rolling forward or backward during deployment doesn't lead to errors. Before releasing a new version...
Read more >
Feature service error codes—ArcGIS REST APIs
The following table outlines possible error codes, and their causes, for feature ... GeoAnalytics (Get Started) ... Edits to layer <layer ID> rolled...
Read more >
Unable to do "Reset" or "Go back" on Windows 11(21H2)
Go in Troubleshoot>Uninstall Updates>Uninstall feature update. ... In this video, I will be showing you how to roll back to Windows 10 even...
Read more >
Feature request | Altium Designer | Knowledge Base
Something is not working the way I expect or want it to work. I would like to see an enhancement.
Read more >
How to Rollback WordPress - Undo WordPress Updates (Easy ...
Simply select an older version and then click the 'Rollback' button. The plugin will now display a warning message. This message simply informs ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found