Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
7.71k stars 245 forks source link

Implement error handling at multiple levels #3861

Closed risjai closed 3 weeks ago

risjai commented 3 weeks ago

Implemented comprehensive error handling at multiple levels:

Output :

timestamp=2024-10-30T11:38:21.770Z level=INFO fiber=#0 message="Attempting to connect to SQL..."
timestamp=2024-10-30T11:38:21.772Z level=INFO fiber=#0 message="Connected to SQL!"
timestamp=2024-10-30T11:38:21.791Z level=ERROR fiber=#0 message="Program Error: SqlError: 28P01: password authentication failed for user \"jain.r\""
Fatal Error: SqlError: 28P01: password authentication failed for user "jain.r"
    at ErrorResponse (/Users/jain.r/workspace/mine/effect-postgres-demo/node_modules/postgres/cjs/src/connection.js:788:26)
    at handle (/Users/jain.r/workspace/mine/effect-postgres-demo/node_modules/postgres/cjs/src/connection.js:474:6)
    at Socket.data (/Users/jain.r/workspace/mine/effect-postgres-demo/node_modules/postgres/cjs/src/connection.js:315:9)
    at Socket.emit (node:events:507:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Socket.Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

Type

Description

Related

changeset-bot[bot] commented 3 weeks ago

⚠️ No Changeset found

Latest commit: 5067fb6cb42dbd3478a62dc1c68615fbfdc992dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

risjai commented 3 weeks ago

@tim-smart This PR was not supposed to be merged. I forgot to mention this in description. It was meant to be an example for the bug : https://github.com/Effect-TS/effect/issues/2730#issuecomment-2446792222