Questions tagged [custom-exception]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
27 views

Q&A CustomExceptions and the DeveloperConsole

I have a process that I have been building for the last couple weeks that should only be run in Sandbox. I have gotten most of test coverage finished and reporting 100% coverage in Sandbox UnitTests ...
  • 1,380
1 vote
1 answer
294 views

Platform Event Trigger Test: Set CreatedById OR catch trigger exceptions?

I have a Platform Event with a trigger I am writing tests for. This trigger inserts a record and throws a custom exception if there is a DML error. I want to make assertions about the message in ...
6 votes
2 answers
653 views

System.assert() in production code? (vs. custom exception)

It's come to my attention that you can use System.assert(), System.assertEquals(), etc. outside of test classes in Apex. I've seen a lot of custom Exception classes written that do nothing but extend ...
2 votes
1 answer
212 views

How to disable constructors in custom exceptions?

There is a lot out there on how you can't override exception constructors and how to do custom exceptions, but I haven't been able to find anything on disabling a constructor for an extended class. I'...
  • 73
9 votes
0 answers
704 views

Rethrowing an exception is missing the stackTraceString

I have code that is wrapped into a main try-catch block and then inside of that I have another try-catch which I am using for a specific use case. If the inner try-catch gets triggered I then use a ...
  • 4,621