Triggering An Exception

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€86.38
List Price:  €120.94
You save:  €34.55
£75.04
List Price:  £105.06
You save:  £30.02
CA$136.68
List Price:  CA$191.36
You save:  CA$54.67
A$142.84
List Price:  A$199.99
You save:  A$57.14
S$128.07
List Price:  S$179.30
You save:  S$51.23
HK$782.02
List Price:  HK$1,094.86
You save:  HK$312.84
CHF 78.19
List Price:  CHF 109.48
You save:  CHF 31.28
NOK kr965.72
List Price:  NOK kr1,352.04
You save:  NOK kr386.32
DKK kr645.41
List Price:  DKK kr903.60
You save:  DKK kr258.19
NZ$170.26
List Price:  NZ$238.38
You save:  NZ$68.11
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,225.31
List Price:  ৳17,115.92
You save:  ৳4,890.61
₹9,175.88
List Price:  ₹12,846.60
You save:  ₹3,670.72
RM394.56
List Price:  RM552.40
You save:  RM157.84
₦138,654.13
List Price:  ₦194,121.33
You save:  ₦55,467.20
₨27,934.58
List Price:  ₨39,109.53
You save:  ₨11,174.94
฿3,194.48
List Price:  ฿4,472.40
You save:  ฿1,277.92
₺4,407.03
List Price:  ₺6,170.02
You save:  ₺1,762.99
B$527.83
List Price:  B$738.99
You save:  B$211.15
R1,667.11
List Price:  R2,334.02
You save:  R666.91
Лв168.93
List Price:  Лв236.52
You save:  Лв67.58
₩148,806.20
List Price:  ₩208,334.64
You save:  ₩59,528.43
₪309.05
List Price:  ₪432.68
You save:  ₪123.63
₱5,916.33
List Price:  ₱8,283.10
You save:  ₱2,366.77
¥15,784.63
List Price:  ¥22,099.12
You save:  ¥6,314.48
MX$1,778.59
List Price:  MX$2,490.10
You save:  MX$711.51
QR364.52
List Price:  QR510.35
You save:  QR145.82
P1,344.82
List Price:  P1,882.80
You save:  P537.98
KSh12,913.70
List Price:  KSh18,079.70
You save:  KSh5,166
E£5,009.34
List Price:  E£7,013.28
You save:  E£2,003.94
ብር15,504.92
List Price:  ብር21,707.51
You save:  ብር6,202.59
Kz91,203.97
List Price:  Kz127,689.21
You save:  Kz36,485.24
CLP$90,607.93
List Price:  CLP$126,854.73
You save:  CLP$36,246.80
CN¥690.40
List Price:  CN¥966.58
You save:  CN¥276.18
RD$5,945.44
List Price:  RD$8,323.86
You save:  RD$2,378.41
DA13,080.08
List Price:  DA18,312.64
You save:  DA5,232.55
FJ$221.02
List Price:  FJ$309.44
You save:  FJ$88.42
Q766.69
List Price:  Q1,073.40
You save:  Q306.70
GY$20,913.73
List Price:  GY$29,280.06
You save:  GY$8,366.32
ISK kr12,500.74
List Price:  ISK kr17,501.54
You save:  ISK kr5,000.80
DH928.53
List Price:  DH1,299.98
You save:  DH371.45
L1,729.34
List Price:  L2,421.14
You save:  L691.80
ден5,312.08
List Price:  ден7,437.13
You save:  ден2,125.04
MOP$805.31
List Price:  MOP$1,127.47
You save:  MOP$322.15
N$1,649.37
List Price:  N$2,309.19
You save:  N$659.81
C$3,678.65
List Price:  C$5,150.26
You save:  C$1,471.60
रु14,666.21
List Price:  रु20,533.28
You save:  रु5,867.07
S/341.02
List Price:  S/477.44
You save:  S/136.42
K430.54
List Price:  K602.77
You save:  K172.23
SAR375.31
List Price:  SAR525.45
You save:  SAR150.14
ZK1,924.29
List Price:  ZK2,694.09
You save:  ZK769.79
L440.02
List Price:  L616.05
You save:  L176.02
Kč2,106.81
List Price:  Kč2,949.63
You save:  Kč842.81
Ft33,807.45
List Price:  Ft47,331.79
You save:  Ft13,524.33
SEK kr924.17
List Price:  SEK kr1,293.87
You save:  SEK kr369.70
ARS$140,735.31
List Price:  ARS$197,035.07
You save:  ARS$56,299.75
Bs690.69
List Price:  Bs967
You save:  Bs276.30
COP$375,853.07
List Price:  COP$526,209.33
You save:  COP$150,356.26
₡47,117.57
List Price:  ₡65,966.48
You save:  ₡18,848.91
L2,645.92
List Price:  L3,704.39
You save:  L1,058.47
₲654,551.20
List Price:  ₲916,397.86
You save:  ₲261,846.66
$U3,934.14
List Price:  $U5,507.95
You save:  $U1,573.81
zł369.64
List Price:  zł517.51
You save:  zł147.87
Already have an account? Log In

Transcript

Hello, in this video, I am going to show you how to trigger an error. So this would trigger an error, you know, because the problem would be if you essentially want to trigger an error manually. So that might not be a problem that would generally, you know, trigger the error. But you know, maybe the user input some data, let's do something like that I'm not gonna do it, like any sort of input, who's gonna have dollar or equals 10, or maybe 10s, invalid, and put 11, maybe type a zero to 10. So let's say if I put $1, I am greater than 10, then we're going to basically trigger an error trigger the error and we just do throw new exception. And we just say whatever the error is, number if we reload that, we get uncaught exception number two large.

So as you can see, we have, you know, thrown an error thrown an exception. And if we want to actually override the exception, so it actually has a custom method instead of error handler, you want to do exception. So set exception handler, and we'll rename this to exception should just be dollar section a bit more basic. And we can do it from here. connection and get an individual Return. So what we can do get the message through a bunch of other stuff and I recommend having a look at what else you can do as well.

There you go number two large, or I'm also going to do is append a string or say an exception. And they are number two large. So that is how you trigger an error and exception manually. So that's it. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.