exam questions

Exam PL-400 All Questions

View all questions & answers for the PL-400 exam

Exam PL-400 topic 12 question 1 discussion

Actual exam question from Microsoft's PL-400
Question #: 1
Topic #: 12
[All PL-400 Questions]

You need to handle errors in UpdateRecord.js.
Which code segment should you add at line UR04?

  • A. catch(error) { alert("Caught error: " + error.message);}
  • B. Exception exception = Server.GetLastError(); if(exception != null)
  • C. Catch(exception e){ console.writeline(e)}
  • D. function (error){ console.log(error.message)}
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
PappuKumar
Highly Voted 3 years, 6 months ago
Answer is D. Please refer MS article: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/updaterecord
upvoted 27 times
...
nivanpee
Highly Voted 3 years, 5 months ago
Selected Answer: D
Answer is D
upvoted 14 times
...
Juan0414
Most Recent 3 months, 3 weeks ago
Selected Answer: D
Correct! GPT: Analysis of Options catch(error) { alert("Caught error: " + error.message); } ✅ Valid JavaScript syntax, but ❌ alert() is not recommended for logging errors in a production environment. Exception exception = Server.GetLastError(); if(exception != null)} ❌ Incorrect—This is C#/.NET syntax and does not work in JavaScript. catch(exception e){ console.writeline(e)} ❌ Incorrect—console.writeline(e) is not a valid JavaScript function (it's from C#). function (error){ console.log(error.message)} ✅ Correct answer—Uses JavaScript's logging mechanism properly with console.log(error.message)
upvoted 1 times
...
b86b167
9 months, 3 weeks ago
This case study was on my exam on the 6th of September 2024.
upvoted 3 times
...
ryanzombie
10 months ago
Selected Answer: D
Do function(error) or Do Not. (because) There is no Try.
upvoted 1 times
...
lezzles11
1 year, 10 months ago
should be function error (result) { console.log(result) } not just function (result) {
upvoted 1 times
...
28122016
1 year, 11 months ago
Selected Answer: D
Answer is D 100%
upvoted 1 times
...
leoprepexam97
2 years, 1 month ago
Selected Answer: D
honestly never seen a catch after a function success
upvoted 2 times
...
oleav
2 years, 2 months ago
Selected Answer: D
Viz PappuKumar link
upvoted 1 times
...
Moradmoro
2 years, 4 months ago
Selected Answer: D
Answer is D
upvoted 1 times
...
MrWood47
2 years, 5 months ago
Selected Answer: D
Answer is D
upvoted 1 times
...
CRMBug
2 years, 7 months ago
Selected Answer: D
Answer is D
upvoted 1 times
...
TheExamMaster2020
2 years, 7 months ago
I had this case on my exam on 27/10/2022. I don't remember if this specific question was asked.
upvoted 1 times
...
kvargas90
2 years, 8 months ago
Selected Answer: D
Answer is D
upvoted 2 times
...
Fabsworth
3 years, 3 months ago
Selected Answer: D
Agree with nivanpee and PrincipalJoe. Answer is D.
upvoted 2 times
...
PrincipalJoe
3 years, 4 months ago
The .then() method returns a promise which expects two arguments: a callback function for the success and one for the error case! so the correct answer is D!!
upvoted 2 times
...
ppguru
3 years, 5 months ago
You handle errors by using the throw, try...catch, finally, and retry statements to generate and handle exceptions. -- Answer seems right to me
upvoted 1 times
DimpleG
2 years, 4 months ago
Then, where is the try block?
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...