mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-05-18 12:02:53 +02:00
fix(scripts): better handle error case in solution
This commit is contained in:
@ -9,8 +9,12 @@ const main = async () => {
|
||||
const inputFile = await fs.readFile(inputPath)
|
||||
const inputJSON = JSON.parse(inputFile)
|
||||
|
||||
const result = solution.apply(null, inputJSON)
|
||||
await fs.writeFile(outputPath, JSON.stringify(result))
|
||||
try {
|
||||
const result = solution.apply(null, inputJSON)
|
||||
await fs.writeFile(outputPath, JSON.stringify(result))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
@ -1,4 +1,4 @@
|
||||
import os
|
||||
import os
|
||||
import json
|
||||
from solution import solution
|
||||
|
||||
|
@ -11,8 +11,12 @@ const main = async () => {
|
||||
const inputFile = await fs.readFile(inputPath)
|
||||
const inputJSON = JSON.parse(inputFile.toString())
|
||||
|
||||
const result = solution.apply(null, inputJSON)
|
||||
await fs.writeFile(outputPath, JSON.stringify(result))
|
||||
try {
|
||||
const result = solution.apply(null, inputJSON)
|
||||
await fs.writeFile(outputPath, JSON.stringify(result))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
Reference in New Issue
Block a user