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

This is an initial PR for Issue #70 and handling of frame errors in general. #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
343 changes: 343 additions & 0 deletions spec/generate.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Bunny/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Bunny\Protocol\Buffer;
use Bunny\Protocol\ContentBodyFrame;
use Bunny\Protocol\ContentHeaderFrame;
use Bunny\Protocol\FrameError;
use Bunny\Protocol\HeartbeatFrame;
use Bunny\Protocol\MethodBasicAckFrame;
use Bunny\Protocol\MethodBasicConsumeOkFrame;
Expand Down Expand Up @@ -620,7 +621,7 @@ public function onFrameReceived(AbstractFrame $frame)
}

} else {
throw new ChannelException("Unhandled method frame " . get_class($frame) . ".");
throw (new FrameError())->get($frame, 'Channel method frame error received.');
}

} elseif ($frame instanceof ContentHeaderFrame) {
Expand Down Expand Up @@ -694,7 +695,7 @@ public function onFrameReceived(AbstractFrame $frame)
throw new ChannelException("Unexpected heartbeat frame.");

} else {
throw new ChannelException("Unhandled frame " . get_class($frame) . ".");
throw (new FrameError())->get($frame, 'Channel content body frame error received.');
}
}

Expand Down Expand Up @@ -767,4 +768,3 @@ protected function onBodyComplete()
}
}
}

11 changes: 11 additions & 0 deletions src/Bunny/Exception/FrameException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace Bunny\Exception;

/**
* Error based on AMQP frame.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
class FrameException extends BunnyException
{
}
15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError320Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 320 'CONNECTION-FORCED' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError320Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError402Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 402 'INVALID-PATH' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError402Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError501Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 501 'FRAME-ERROR' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError501Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError502Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 502 'SYNTAX-ERROR' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError502Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError503Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 503 'COMMAND-INVALID' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError503Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError504Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 504 'CHANNEL-ERROR' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError504Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError505Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 505 'UNEXPECTED-FRAME' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError505Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError506Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 506 'RESOURCE-ERROR' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError506Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError530Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 530 'NOT-ALLOWED' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError530Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError540Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 540 'NOT-IMPLEMENTED' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError540Exception extends FrameHardErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameHardError541Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 541 'INTERNAL-ERROR' (hard-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameHardError541Exception extends FrameHardErrorException
{
}

11 changes: 11 additions & 0 deletions src/Bunny/Exception/FrameHardErrorException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace Bunny\Exception;

/**
* Hard Error based on AMQP frame.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
class FrameHardErrorException extends FrameException
{
}
15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError311Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 311 'CONTENT-TOO-LARGE' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError311Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError312Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 312 'NO-ROUTE' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError312Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError313Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 313 'NO-CONSUMERS' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError313Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError403Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 403 'ACCESS-REFUSED' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError403Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError404Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 404 'NOT-FOUND' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError404Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError405Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 405 'RESOURCE-LOCKED' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError405Exception extends FrameSoftErrorException
{
}

15 changes: 15 additions & 0 deletions src/Bunny/Exception/FrameSoftError406Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Bunny\Exception;

/**
* AMQP-0-9-1 Error 406 'PRECONDITION-FAILED' (soft-error).
*
* THIS CLASS IS GENERATED FROM amqp-rabbitmq-0.9.1.json. **DO NOT EDIT!**
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/

class FrameSoftError406Exception extends FrameSoftErrorException
{
}

11 changes: 11 additions & 0 deletions src/Bunny/Exception/FrameSoftErrorException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
namespace Bunny\Exception;

/**
* Soft Error based on AMQP frame.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
class FrameSoftErrorException extends FrameException
{
}
Loading