Skip to content

Commit 3f2fda7

Browse files
committed
👌 Update to match newest requirements
1 parent 6d7fbc3 commit 3f2fda7

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

exercises/concept/errors/.docs/hints.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Hints
2+
13
## 1. Monitor the humidity level of the room
24

35
- You might want to use an [if...else condition][if-else-condition] to check if the humidity percentage is higher than the maximum allowed value.

exercises/concept/errors/.docs/instructions.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Instructions
2+
13
Elena is the new quality manager of a newspaper factory. As she has just arrived in the company, she has decided to review some of the processes in the factory to see what could be improved. She found out that technicians are doing a lot of quality checks by hand. She sees there is a good oportunity for automation and asks you, a freelance developer, to develop a piece of software to monitor some of the machines.
24

35
## Check the humidity level of the production room
@@ -37,12 +39,12 @@ Implements a function `checkHumidityLevel` that takes the humidity percentage as
3739
You should throw an error (the message isn't important) if the percentage exceeds 70%.
3840

3941
```javascript
40-
checkHumidityLevel(60)
42+
checkHumidityLevel(60);
4143
// Returns undefined
4244
```
4345

4446
```javascript
45-
checkHumidityLevel(100)
47+
checkHumidityLevel(100);
4648
// Throws an error
4749
```
4850

@@ -55,12 +57,12 @@ If the sensor is broken, the temperature will be null. In this case you should t
5557
When everything works, if the temperature exceeds 500°C, you should throw a `OverheatingError`. This error class will be instanciated with a temperature argument. Make sure that the `OverheatingError` you throw has a temperature property attached to it.
5658

5759
```javascript
58-
reportOverheating(null)
60+
reportOverheating(null);
5961
// Throws an ArgumentError
6062
```
6163

6264
```javascript
63-
reportOverheating(800)
65+
reportOverheating(800);
6466
// Throws an OverheatingError
6567
```
6668

@@ -91,5 +93,5 @@ monitorTheMachine({
9193
alertDeadSensor,
9294
alertOverheating,
9395
shutdown,
94-
})
96+
});
9597
```
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1+
# Introduction
2+
13
Errors are useful to report when something is wrong or unexpected in a program or a piece of code.
24

35
They are javascript objects.
46

57
The main property of this object is `message`:
68

79
```javascript
8-
const error = new Error('Oops, something went wrong')
10+
const error = new Error('Oops, something went wrong');
911

10-
console.log(error.message)
12+
console.log(error.message);
1113
// => "Oops, something went wrong"
1214
```
1315

1416
Using the `throw` syntax, you can throw an Error.
1517

1618
```javascript
17-
throw new Error('Oops')
19+
throw new Error('Oops');
1820
```
1921

2022
When an Error is thrown, the current execution is stopped and resume in the first catch block of the call stack.
2123

2224
```javascript
2325
try {
24-
throw new Error('Oops')
26+
throw new Error('Oops');
2527
} catch (error) {
26-
console.log(error.message)
28+
console.log(error.message);
2729
// => "Oops"
2830
}
2931
```
@@ -37,7 +39,7 @@ try {
3739
// ... Code that may throw an error
3840
} catch (error) {
3941
if (error instanceof CustomError) {
40-
console.log('The error thrown is an instance of the CustomError')
42+
console.log('The error thrown is an instance of the CustomError');
4143
}
4244
}
4345
```

exercises/concept/errors/.meta/config.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"exercism_username": "TomPradat"
1212
}
1313
],
14-
"editor": {
15-
"solution_files": ["errors.js"],
16-
"test_files": ["errors.spec.js"]
17-
}
14+
"files": {
15+
"solution": ["errors.js"],
16+
"test": ["errors.spec.js"],
17+
"exemplar": [".meta/example.js"]
18+
},
19+
"blurb": "Learn how to handle errors by creating a piece of software for a newspaper factory."
1820
}

exercises/concept/errors/.meta/design.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Design
2+
13
## Goal
24

35
The goal of this exercise is to teach the student how to handle errors / exception, throw them and create their own.

0 commit comments

Comments
 (0)