You need to sign in or sign up before continuing.×
7 kyu
Error Throwing - Error Handling #2
836matt c
Description:
Error Throwing - Error Handling #2
Error Handling is very important in coding. Most error handling seems to be overlooked or not implemented properly.
Task
In this kata you are provided to evaluate a string, you must check for any HTML code (i.e. if any HTML tags are found), if any code is found you must return false, If the input is not a string you must throw a TypeError
, if the string is over 255 characters long or contains 0 characters you must throw a RangeError
and last of all if the string entered is null throw a ReferenceError
.
Error Messages
ReferenceError
new ReferenceError('Message is null!')
TypeError
new TypeError(`Message should be of type string but was of type ${typeof msg}!`)
RangeError
new RangeError(`Message contains ${msg.length} characters!`)
Strings
Fundamentals
Similar Kata:
Stats:
Created | Sep 2, 2015 |
Published | Sep 3, 2015 |
Warriors Trained | 1339 |
Total Skips | 12 |
Total Code Submissions | 5552 |
Total Times Completed | 836 |
JavaScript Completions | 836 |
Total Stars | 13 |
% of votes with a positive feedback rating | 84% of 113 |
Total "Very Satisfied" Votes | 83 |
Total "Somewhat Satisfied" Votes | 23 |
Total "Not Satisfied" Votes | 7 |