Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logger): Represent Zod errors in friendlier format #22238

Merged
merged 3 commits into from May 16, 2023

Conversation

zharinov
Copy link
Collaborator

Changes

  • For logging purposes, ZodError format is too verbose.
  • Sometimes we want to log these errors, but they're too scary.
  • This PR transforms logged error to the more pleasant form.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov marked this pull request as draft May 15, 2023 16:11
@zharinov zharinov requested a review from viceice May 15, 2023 16:22
@zharinov zharinov marked this pull request as ready for review May 15, 2023 16:22
@zharinov zharinov requested a review from rarkins May 15, 2023 16:22
@rarkins
Copy link
Collaborator

rarkins commented May 15, 2023

Do you have an example output?

lib/logger/utils.ts Show resolved Hide resolved
lib/logger/utils.ts Show resolved Hide resolved
@zharinov
Copy link
Collaborator Author

Do you have an example output?

DEBUG: Composer: extract failed (repository=composer/composer)
       "fileName": "tests/Composer/Test/Plugin/Fixtures/plugin-v7/composer.json",
       "err": {
         "message": "Schema error",
         "stack": "ZodError: Schema error\n    at Object.get error [as error] (/Users/jrnv/Work/renovate/node_modules/zod/lib/types.js:43:31)\n    at Object.extractPackageFile (/Users/jrnv/Work/renovate/lib/modules/manager/composer/extract.ts:11:39)\n    at async getManagerPackageFiles (/Users/jrnv/Work/renovate/lib/workers/repository/extract/manager-files.ts:45:19)\n    at async /Users/jrnv/Work/renovate/lib/workers/repository/extract/index.ts:59:28\n    at async Promise.all (index 0)\n    at async extractAllDependencies (/Users/jrnv/Work/renovate/lib/workers/repository/extract/index.ts:56:26)\n    at async extract (/Users/jrnv/Work/renovate/lib/workers/repository/process/extract-update.ts:140:28)\n    at async extractDependencies (/Users/jrnv/Work/renovate/lib/workers/repository/process/index.ts:139:26)\n    at async Object.renovateRepository (/Users/jrnv/Work/renovate/lib/workers/repository/index.ts:61:9)\n    at async attributes.repository (/Users/jrnv/Work/renovate/lib/workers/global/index.ts:184:11)\n    at async start (/Users/jrnv/Work/renovate/lib/workers/global/index.ts:169:7)\n    at async /Users/jrnv/Work/renovate/lib/renovate.ts:18:22",
         "issues": {"lockfile": "Invalid input"}
       }

@zharinov zharinov requested a review from viceice May 16, 2023 12:59
@rarkins rarkins enabled auto-merge May 16, 2023 13:58
@rarkins rarkins added this pull request to the merge queue May 16, 2023
Merged via the queue into renovatebot:main with commit 115ed87 May 16, 2023
11 checks passed
@rarkins rarkins deleted the fix/zod-errors branch May 16, 2023 14:47
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 35.87.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants