Skip to content

Commit d78ab76

Browse files
author
Calvin Allen
committed
NR-381373
Trying to add an actual exception to the front-end
1 parent 89bc57b commit d78ab76

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

client/src/pages/Error.tsx

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
import pets from '/src/assets/images/pets.png';
22

3-
export const Error = () => {
4-
3+
const mapping = new Map<number, string>([
4+
[1,"Dogs"],
5+
[2,"Cats"],
6+
[3,"Horses"],
7+
[4,"Iguanas"],
8+
[5,"Goblin Sharks"]
9+
])
510

6-
const numbers = [0,1,2];
7-
const theNumber = numbers[10];
11+
export const Error = () => {
12+
const renderListItem = (index: number) => {
13+
const item = mapping.get(index);
14+
return (
15+
<li>{item}</li>
16+
)
17+
}
818

9-
return (
10-
<>
11-
<div className="row">
12-
<div className="col-md-12">
13-
<img className="img-responsive" src={pets} />
14-
</div>
15-
</div>
16-
<h2>Something happened...</h2>
17-
<h3>{theNumber}</h3>
18-
</>
19-
);
19+
return (
20+
<>
21+
<div className="row">
22+
<div className="col-md-12">
23+
<img className="img-responsive" src={pets} />
24+
</div>
25+
</div>
26+
<h3>
27+
<ol>
28+
{[1,2,3,4,5,6].map(i => renderListItem(i))}
29+
</ol>
30+
</h3>
31+
</>
32+
);
2033
};

0 commit comments

Comments
 (0)