logto-io / js

🤓 Logto JS SDKs.
https://docs.logto.io/quick-starts/
MIT License
68 stars 40 forks source link

feat(node): ignore fetch user info error in getContext #769

Closed wangsijie closed 4 months ago

wangsijie commented 4 months ago

Summary

Wrap getUserInfo with trySafe in node SDK's getContext method. This method should not throw error if getUserInfo failed, it should return undefined for better development experience. If the developer want the handle the error manually, he can use client.getUserInfo instead.

This PR is similar to https://github.com/logto-io/js/pull/739

Testing

Local tested and exiting tests shoudl pass.

Checklist

wangsijie commented 4 months ago

This is a breaking change, per discussion, close for now. Open another PR when we are ready.