Skip to content
Back to skills

Exception Handling And Logging

ASecurity

Use reportable/renderable exceptions, structured logs, and channel strategy for observability and graceful failures

  • 147 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added June 6, 2026
securityphpapi

Works with

  • api

Security analysis

A100/100

Scanned June 6, 2026

npx -y skills add jpcaparas/superpowers-laravel --skill exception-handling-and-logging --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Exception Handling And Logging?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Exception Handling And Logging
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jpcaparas-exception-handling-and-logging/badge)](https://www.skillsdirectory.com/skills/jpcaparas-exception-handling-and-logging)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: laravel:exception-handling-and-logging
description: Use reportable/renderable exceptions, structured logs, and channel strategy for observability and graceful failures
---

# Exception Handling and Logging

Treat errors as first-class signals; provide context and paths to remediation.

## Commands

```
// app/Exceptions/Handler.php
public function register(): void
{
    $this->reportable(function (DomainException $e) {
        Log::warning('domain exception', ['code' => $e->getCode()]);
    });

    $this->renderable(function (ModelNotFoundException $e, $request) {
        if ($request->expectsJson()) {
            return response()->json(['message' => 'Not Found'], 404);
        }
    });
}
```

## Patterns

- Use domain-specific exceptions for expected error paths
- Add structured context to logs; avoid logging secrets
- Route noisy logs to separate channels; keep defaults actionable
- Convert to API-appropriate responses in `renderable()`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.