Don't show timing on error for clearer error output

This commit is contained in:
Benoit Daloze
2023-02-11 13:48:39 +01:00
parent 2cf593d66b
commit bc4e585e26
2 changed files with 14 additions and 16 deletions
+7 -8
View File
@@ -47,17 +47,16 @@ export async function measure(name, block) {
} }
} }
// Same as mesaure() but without the group // Same as mesaure() but without the group, and no time shown on error
export async function time(name, block) { export async function time(name, block) {
console.log(`> ${name}`) console.log(`> ${name}`)
const start = performance.now() const start = performance.now()
try { const value = await block()
return await block() const end = performance.now()
} finally {
const end = performance.now() const duration = (end - start) / 1000.0
const duration = (end - start) / 1000.0 console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`)
console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`) return value
}
} }
export function isHeadVersion(rubyVersion) { export function isHeadVersion(rubyVersion) {
Generated Vendored
+7 -8
View File
@@ -349,17 +349,16 @@ async function measure(name, block) {
} }
} }
// Same as mesaure() but without the group // Same as mesaure() but without the group, and no time shown on error
async function time(name, block) { async function time(name, block) {
console.log(`> ${name}`) console.log(`> ${name}`)
const start = performance.now() const start = performance.now()
try { const value = await block()
return await block() const end = performance.now()
} finally {
const end = performance.now() const duration = (end - start) / 1000.0
const duration = (end - start) / 1000.0 console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`)
console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`) return value
}
} }
function isHeadVersion(rubyVersion) { function isHeadVersion(rubyVersion) {