Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce DEX-450 Exam - Topic 11 Question 89 Discussion

Posted by Coleen on May 10, 2024 at 05:04 PM

A developer creates a custom exception as shown below:

public class ParityException extends Exception {}

What are two ways the developer can fire the exception in Apex?

Choose 2 answers

Suggested Answer: B, D

Get Premium DEX-450 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
32 comments · newest first
JE
Jesse 11 months ago
"throw new ParityException('parity does not match');" is also valid!
LA
Lashon 11 months ago
Wait, can you really throw it without a message?
TY
Ty 12 months ago
Agree, "throw new ParityException();" is the way to go!
EF
Effie 12 months ago
I think "new ParityException();" alone won't work.
BE
Beula 1 year ago
You can definitely use "throw new ParityException();" to fire it.
FI
Fidelia 1 year ago
I’m not completely certain, but I think you need to use the throw keyword to actually fire the exception, so that makes me lean towards B and D.
KA
Kati 1 year ago
I feel like we practiced something similar where we had to throw custom exceptions, and I think both B and D might be the right answers.
AH
Ahmed 1 year ago
I think option B is definitely one way to throw the exception, but I'm a bit confused about whether option D is also correct.
WH
Whitley 1 year ago
I remember we discussed how to throw exceptions in our last study session, but I'm not entirely sure if option A is valid since it doesn't use the throw keyword.
SH
Sherita 1 year ago
I'm feeling pretty confident about this one. The two correct answers are B and D - throwing the exception with or without a custom message. I'll make sure to double-check my work, but I think I've got a good handle on how to fire this custom exception.
MA
Madonna 1 year ago
Hmm, I'm a little unsure about this one. I know we need to throw the exception, but I'm not sure if we need to include a message or not. I'll have to think this through carefully.
HE
Helga 1 year ago
This looks pretty straightforward. I think the two correct ways to fire the ParityException are B and D.
ME
Melvin 1 year ago
Okay, I've got this. The two ways to fire the exception are B) throw new ParityException('parity does not match'); and D) throw new ParityException();. The first one includes a custom message, while the second one just throws the exception without a message.
TA
Talia 1 year ago
Hmm, I'm a bit unsure about this one. I know the severity is important, but I'm not sure exactly what goes into that assessment. I'll have to think it through carefully.
TE
Terry 1 year ago
Okay, let me think this through. The key requirements are around restricting the device and application to only the necessary functionality for inventory management. I think option B, using a MAC security policy, could be a good way to achieve that.
MA
Malinda 2 years ago
True, so it's A and D then. A bit tricky but manageable once you think it through.
JA
Jamal 2 years ago
B looks correct but it has a string parameter which our custom exception doesn't handle.
ED
Edward 2 years ago
Ha! I guess the developer is really into parity. Maybe they should create a 'ParityMatchException' instead. But B and D are the correct answers.
LA
Lamonica 2 years ago
I think both B and D are correct. Depends on whether you want to include a custom message or not.
HE
Helga 2 years ago
↳ replying to Lamonica
B) throw new ParityException("parity does not match");
RU
Rusty 2 years ago
↳ replying to Lamonica
A) new ParityException();
LI
Lisha 2 years ago
↳ replying to Lamonica
B) throw new ParityException("parity does not match");
JO
Jose 2 years ago
↳ replying to Lamonica
B) throw new ParityException("parity does not match");
CO
Cortney 2 years ago
↳ replying to Lamonica
A) new ParityException();
KI
Kiera 2 years ago
↳ replying to Lamonica
A) new ParityException();
RO
Rossana 2 years ago
Good point. Actually, D seems right. Also, B looks like it might be okay?
MA
Ma 2 years ago
I agree with option D for sure. But isn't option A missing a throw keyword?
DE
Delsie 2 years ago
Option B is the way to go! Throwing the exception with a message is more informative for the caller.
HO
Hoa 2 years ago
↳ replying to Delsie
B) throw new ParityException("parity does not match");
TA
Tawny 2 years ago
↳ replying to Delsie
A) new ParityException();
JA
Jamal 3 years ago
Yup, throwing exceptions in Apex is important too. I'm leaning towards options A and D.
MA
Malinda 3 years ago
This question is quite technical. Understanding custom exceptions is crucial.
0/2000 characters

Save Cancel