Hierarchy Constraint Violation -- salesforce.com - salesforce

Salesforce has thrown a new error message at me, and so far I haven't found anything useful in the docs about this. I am trying to save an object in a controller extension, and it does in fact save the record, but instead of returning to the page that I indicate, it shows me the error message "Hierarchy Constraint Violation". In looking over the debug logs, this does not show up anywhere, despite the fact that I log as error any DML exceptions and re-throw them. I am not stifling any other exceptions, either.
I can't tell what this error even means, let alone where it is coming from.

The problem turns out to be an attempt to create a self reference.

Related

How to catch an error and stop my bot from crashing

So basically I'm looking for a way to stop my bot from crashing because of user error or a bug in my code. What I want to bot to do is catch an error and respond to the message sender saying "Error! ${errormessage}". hopefully you understand what I mean.
You could use try-catch or simply .catch
This is a basic javascript topic, you can read and learn error handling here
Point to note is, you need to locate the line which is throwing the error by analyzing the error log.
Keep in mind you can only prevent the bot from crashing by using the above stated methods on runtime errors otherwise known as exceptions (ex: unhandledPromiseRejection, thrown during runtime), you cannot use this method on errors like TypeError, SyntaxError etc (Errors thrown while parsing the code), such errors can only be fixed by manually identifying the line and applying appropriate fix

Performance counter MSSQLInstance\SQL Errors\Errors/sec\User Errors whats in it?

Im wondering what kind of errors would show up in:
SQL Errors\Errors/sec\User errors
Technet just says:
Information about user errors.
I need more info, what events cause this counter to increment?

Don't log some kind of exceptions

I am running a pretty big application, with a few thousand users and I like to check the log files (almost) daily, to see if something has gone wrong.
Fortunately the system is quite stable, but I am having a lot of Invalid CSRF token, Record not found in table X with primary key [NULL], (and so on) errors. I usually ignore that kind of errors, since there is not much that I can do to avoid them.
Is there a way to tell the logger not to save those kind of exceptions in my log files?
Check the Error section of your applications app.php configuration file, specifically the explanation for the skipLog option.
[...]
skipLog - array - List of exceptions to skip for logging. Exceptions that extend one of the listed exceptions will also be skipped for logging. E.g.:
'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']
[...]
You'd want to skip \Cake\Network\Exception\NotFoundException and \Cake\Network\Exception\InvalidCsrfTokenException.
If you need more fine-grained control, then you'd have to create a custom error handler and override for example BaseErrorHandler::_logException() where you could inspect the exception and act accordingly.
See also
Cookbook > Error & Exception Handling > Error & Exception Configuration
Cookbook > Error & Exception Handling > Creating your Own Error Handler

Parsing sqlexception error messages

I'm using C# for end user forms,and what i want to do is to parse the error messages I get from the SQL server.Normally the end user gets the messages like in the picture.Is there a way to parse this and to give the end user what he understands instead of that gibberish there? (like "The Name Test is not permitted in this context .... " as in the picture.)
sql error code
Use Exception.ToString to display a full stack trace. Use Exception.Message to get just the text description part of the error.
In addition, you can look at the SqlException.Class and SqlException.Number properties to make informed decisions about how to handle these exceptions in your code. The SqlException.Number property will correspond to an entry in the sys.messages view. 1205, for example, is the number for a deadlock exception. And if SqlException.Class = 11, then that is a concurrency exception.
The SqlException.Errors property is a list of SqlError objects that contain more detailed information about individual errors. Since a single RPC call to the database can result in multiple exceptions, review these errors to see everything that happened.
exception.ToString() will produce a string like your picture, generally. exception.Message will include just the error message, no stack trace.
When reporting errors in SQL there is always a dilemma where the SQL message needs to convey to the developer what happen, but also provide useful information to a user of the application. We developed a technique of structuring the SQL message into an XML string that provides all the useful information about the error, which allows the caller to use as required. You can see my article on this technique on Code Project at the URL below:
http://www.codeproject.com/Articles/1076477/SQL-Server-Structure-Error-Handling

CakePHP: Error: Database table cake_errors for model CakeError was not found

I have a CakePHP error and I having a hard time to trace the problem. Hope you can help me.
Here is the error message:
Missing Database Table
Error: Database table cake_errors for model CakeError was not found.
Notice: If you want to customize this error message, create app/views/errors/missing_table.ctp
Am I missing something here?
Thanks in Advance.
Cheers,
Mark
Its hard to tell why exactly without seeing the code firsthand, one trick i have used with theese kinds of errors though is making "app/views/errors/missing_table.ctp" as inserting the following code
<?php pr( Debugger::trace() ); ?>
This will will help workout what you called to cause this issue in the first place.
I realize this question is 4 years old, but since I bumped into the exact same problem and found no information about it that could explain where the error is coming from, I did some digging of my own and come up with some clues that I include here in case it helps.
My AppController beforeFiler() method, amongst other things, uses a function that checks if the Model of the Controller has enum fields (I know... I know...) and handles them "properly".
When an error in the application triggers an Exception (Nothing fancy... a "Missing Controller" does it) and the debug level is 0, the CakeErrorController tries to render the exception and it fails because there's no cake_errors table, generating an endless loop that ends when PHP runs out of memory.
I fixed this by improving the detection of whether the main Model of the controller is indeed using a "real" table.

Resources