Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const ERROR_RATE = 0.25
- function should_fail () {
- return Math.random() < ERROR_RATE
- }
- function main(params) {
- if (!params.a || !params.b) throw new Error('Missing input parameters (a or b).')
- if (should_fail()) throw new Error('failed!')
- const sum = params.a + params.b
- return { sum }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement