0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/hogvm/__tests__/exceptions.hog

69 lines
840 B
Plaintext
Raw Normal View History

2024-07-25 16:57:28 +02:00
print('start')
try {
print('try')
} catch (e) {
print(f'{e} was the exception')
}
print('------------------')
print('start')
try {
print('try')
} catch {
print('No var for error, but no error')
}
print('------------------')
try {
print('try again')
throw Error()
} catch (e) {
print(f'{e} was the exception')
}
print('------------------')
try {
print('try again')
throw Error()
} catch {
print('No var for error')
}
print('------------------')
2024-08-30 11:51:36 +02:00
fun third() {
2024-07-25 16:57:28 +02:00
print('Throwing in third')
throw Error('Threw in third')
}
2024-08-30 11:51:36 +02:00
fun second() {
2024-07-25 16:57:28 +02:00
print('second')
third()
}
2024-08-30 11:51:36 +02:00
fun first() {
2024-07-25 16:57:28 +02:00
print('first')
second()
}
2024-08-30 11:51:36 +02:00
fun base() {
2024-07-25 16:57:28 +02:00
print('base')
try {
first()
} catch (e) {
print(f'Caught in base: {e}')
throw e
}
}
try {
base()
} catch (e) {
print(f'Caught in root: {e}')
}
print('The end')