Skip to content

Do not die when initializing the watermarker#4138

Merged
ildyria merged 2 commits intomasterfrom
avoid-throwing
Mar 2, 2026
Merged

Do not die when initializing the watermarker#4138
ildyria merged 2 commits intomasterfrom
avoid-throwing

Conversation

@ildyria
Copy link
Member

@ildyria ildyria commented Mar 2, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in watermark initialization. Errors during watermark setup are now logged instead of terminating the process, ensuring the application continues to run smoothly even if watermarking encounters issues.

@ildyria ildyria requested a review from a team as a code owner March 2, 2026 17:27
@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

The Watermarker constructor's initialization logic is now wrapped in a try-catch block that handles any Throwable exceptions. Exceptions occurring during watermark checks are logged via Log::error and execution continues, while preserving existing early return behavior within the protected try block.

Changes

Cohort / File(s) Summary
Constructor Error Handling
app/Image/Watermarker.php
Added try-catch wrapper to constructor initialization that catches and logs exceptions instead of propagating them, while maintaining early return behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A try-catch hops through your code,
Where errors once caused the path to erode,
Now logged with grace, they gently fade,
Initialization dances unafraid! ✨

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
app/Image/Watermarker.php (1)

45-45: Use structured exception context in logger call.

Log::error(..., [$t]) stores the throwable under a numeric key. Prefer ['exception' => $t] so handlers consistently capture stack/context.

Proposed patch
-		} catch (\Throwable $t) {
-			Log::error('Failed to initialize Watermarker', [$t]);
+		} catch (\Throwable $t) {
+			Log::error('Failed to initialize Watermarker', ['exception' => $t]);
 		}

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 425329f and 51dcf92.

📒 Files selected for processing (1)
  • app/Image/Watermarker.php

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.37%. Comparing base (425329f) to head (51dcf92).
⚠️ Report is 1 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria merged commit 5e40be8 into master Mar 2, 2026
44 checks passed
@ildyria ildyria deleted the avoid-throwing branch March 2, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant