@@ -119,7 +119,11 @@ public function __construct(
119119 $ context
120120 );
121121 } catch (T \Exception $ e ) {
122- throw new SocketException ('Error connecting to RouterOS ' , 100 , $ e );
122+ throw new SocketException (
123+ 'Error connecting to RouterOS ' ,
124+ SocketException::CODE_CONNECTION_FAIL ,
125+ $ e
126+ );
123127 }
124128 $ this ->setCharset (
125129 self ::getDefaultCharset (self ::CHARSET_ALL ),
@@ -369,7 +373,7 @@ public function sendWordFromStream($prefix, $stream)
369373 if (!self ::isSeekableStream ($ stream )) {
370374 throw new InvalidArgumentException (
371375 'The stream must be seekable. ' ,
372- 1100
376+ InvalidArgumentException:: CODE_SEEKABLE_REQUIRED
373377 );
374378 }
375379 if (null !== ($ remoteCharset = $ this ->getCharset (self ::CHARSET_REMOTE ))
@@ -421,7 +425,7 @@ protected static function verifyLengthSupport($length)
421425 if ($ length > 0xFFFFFFF ) {
422426 throw new LengthException (
423427 'Words with length above 0xFFFFFFF are not supported. ' ,
424- 1200 ,
428+ LengthException:: CODE_UNSUPPORTED ,
425429 null ,
426430 $ length
427431 );
@@ -440,7 +444,7 @@ public static function encodeLength($length)
440444 if ($ length < 0 ) {
441445 throw new LengthException (
442446 'Length must not be negative. ' ,
443- 1300 ,
447+ LengthException:: CODE_INVALID ,
444448 null ,
445449 $ length
446450 );
@@ -462,7 +466,7 @@ public static function encodeLength($length)
462466 }
463467 throw new LengthException (
464468 'Length must not be above 0x7FFFFFFFF. ' ,
465- 1301 ,
469+ LengthException:: CODE_BEYOND_SHEME ,
466470 null ,
467471 $ length
468472 );
@@ -601,7 +605,7 @@ private static function _decodeLength(T\Stream $trans)
601605 }
602606 throw new NotSupportedException (
603607 'Unknown control byte encountered. ' ,
604- 1601 ,
608+ NotSupportedException:: CODE_CONTROL_BYTE ,
605609 null ,
606610 $ byte
607611 );
0 commit comments