- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
74 lines
2.5 KiB
PHP
74 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\Queue\Exceptions\JobNotFoundException;
|
|
use App\Framework\Queue\ValueObjects\JobId;
|
|
use App\Framework\ErrorHandling\ErrorHandler;
|
|
use App\Framework\DI\DefaultContainer;
|
|
use App\Framework\Http\ResponseEmitter;
|
|
use App\Framework\Http\RequestIdGenerator;
|
|
|
|
echo "=== Testing ErrorHandler Enhancements ===\n\n";
|
|
|
|
// Create minimal container for ErrorHandler
|
|
$container = new DefaultContainer();
|
|
$emitter = new ResponseEmitter();
|
|
$requestIdGenerator = new RequestIdGenerator();
|
|
|
|
$errorHandler = new ErrorHandler(
|
|
$emitter,
|
|
$container,
|
|
$requestIdGenerator,
|
|
null,
|
|
true // Debug mode to see recovery hints
|
|
);
|
|
|
|
// Test 1: Create a JobNotFoundException (uses QUEUE007 error code)
|
|
echo "Test 1: JobNotFoundException with ErrorCode integration\n";
|
|
echo str_repeat('-', 60) . "\n";
|
|
|
|
try {
|
|
$jobId = JobId::fromString('test-job-123');
|
|
throw JobNotFoundException::byId($jobId);
|
|
} catch (JobNotFoundException $e) {
|
|
echo "Exception: " . get_class($e) . "\n";
|
|
echo "Message: " . $e->getMessage() . "\n";
|
|
echo "Error Code: " . $e->getErrorCode()->getValue() . "\n";
|
|
echo "Category: " . $e->getErrorCode()->getCategory() . "\n";
|
|
echo "Severity: " . $e->getErrorCode()->getSeverity()->value . "\n";
|
|
echo "Is Recoverable: " . ($e->getErrorCode()->isRecoverable() ? 'Yes' : 'No') . "\n";
|
|
echo "Recovery Hint: " . $e->getErrorCode()->getRecoveryHint() . "\n";
|
|
|
|
// Test ErrorHandler metadata creation
|
|
echo "\nTesting ErrorHandler metadata generation...\n";
|
|
$response = $errorHandler->createHttpResponse($e);
|
|
|
|
echo "HTTP Status Code would be: " . $response->status->value . "\n";
|
|
echo "Response created successfully!\n";
|
|
}
|
|
|
|
echo "\n" . str_repeat('=', 60) . "\n\n";
|
|
|
|
// Test 2: Test with different error code that has Retry-After
|
|
echo "Test 2: Testing with error code that has Retry-After\n";
|
|
echo str_repeat('-', 60) . "\n";
|
|
|
|
use App\Framework\Queue\Exceptions\ChainNotFoundException;
|
|
|
|
try {
|
|
throw ChainNotFoundException::byId('chain-123');
|
|
} catch (ChainNotFoundException $e) {
|
|
echo "Exception: " . get_class($e) . "\n";
|
|
echo "Error Code: " . $e->getErrorCode()->getValue() . "\n";
|
|
echo "Retry After: " . ($e->getErrorCode()->getRetryAfterSeconds() ?? 'null') . " seconds\n";
|
|
|
|
$response = $errorHandler->createHttpResponse($e);
|
|
echo "HTTP Status Code: " . $response->status->value . "\n";
|
|
echo "Response headers would include Retry-After if applicable\n";
|
|
}
|
|
|
|
echo "\n✅ All ErrorHandler enhancement tests completed!\n";
|