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) Fix Webpack compilation error logging on build #829

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

jayasanka-sack
Copy link
Member

@jayasanka-sack jayasanka-sack commented Dec 2, 2023

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

When encountering a webpack compilation error during the build process, it logs [openmrs] undefined. This issue becomes evident in recent build failures[1][2]. The root cause lies in the logger expecting an Error object during promise rejection, but the provided object is not of type Error, leading to a failure in logging the corresponding message.

To address this, I've modified the handling of errors. The stats?.compilation.errors array contains webpack error objects. To facilitate proper logging, I have converted this array into a string and thrown it as a new Error object.

[1] https://github.com/openmrs/openmrs-distro-referenceapplication/actions/runs/7069093486/job/19244414755?pr=765
[2] https://ci.openmrs.org/browse/REFAPP-D3X-F2-2054/log

Screenshots

image image

Related Issue

Other

@jayasanka-sack jayasanka-sack changed the title Handle Webpack compilation errors on build (fix) Handle Webpack compilation errors on build Dec 2, 2023
@jayasanka-sack jayasanka-sack changed the title (fix) Handle Webpack compilation errors on build (fix) Fix Webpack compilation error logging on build Dec 2, 2023
Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks, @jayasanka-sack!

@denniskigen denniskigen merged commit 37e6744 into openmrs:main Dec 2, 2023
7 checks passed
@jayasanka-sack jayasanka-sack deleted the cli-error-log branch December 4, 2023 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants