@@ -69,6 +69,69 @@ trait TraderTrait
6969 public static $ TRADER_ERR_INTERNAL_ERROR = 5000 ;
7070 public static $ TRADER_ERR_UNKNOWN_ERROR = 65535 ;
7171
72+ private static function checkForError ()
73+ {
74+ $ ErrorCode = trader_errno ();
75+ if ($ ErrorCode === static ::$ TRADER_ERR_SUCCESS ) {
76+ return ;
77+ }
78+ if ($ ErrorCode === static ::$ TRADER_ERR_LIB_NOT_INITIALIZE ) {
79+ throw new \Exception ("Library not initialized " , static ::$ TRADER_ERR_LIB_NOT_INITIALIZE );
80+ }
81+ if ($ ErrorCode === static ::$ TRADER_ERR_BAD_PARAM ) {
82+ throw new \Exception ("Bad parameter " , static ::$ TRADER_ERR_BAD_PARAM );
83+ }
84+ if ($ ErrorCode === static ::$ TRADER_ERR_ALLOC_ERR ) {
85+ throw new \Exception ("Allocation error " , static ::$ TRADER_ERR_ALLOC_ERR );
86+ }
87+ if ($ ErrorCode === static ::$ TRADER_ERR_GROUP_NOT_FOUND ) {
88+ throw new \Exception ("Group not found " , static ::$ TRADER_ERR_GROUP_NOT_FOUND );
89+ }
90+ if ($ ErrorCode === static ::$ TRADER_ERR_FUNC_NOT_FOUND ) {
91+ throw new \Exception ("Function not found " , static ::$ TRADER_ERR_FUNC_NOT_FOUND );
92+ }
93+ if ($ ErrorCode === static ::$ TRADER_ERR_INVALID_HANDLE ) {
94+ throw new \Exception ("Invalid handle " , static ::$ TRADER_ERR_INVALID_HANDLE );
95+ }
96+ if ($ ErrorCode === static ::$ TRADER_ERR_INVALID_PARAM_HOLDER ) {
97+ throw new \Exception ("Invalid parameter holder " , static ::$ TRADER_ERR_INVALID_PARAM_HOLDER );
98+ }
99+ if ($ ErrorCode === static ::$ TRADER_ERR_INVALID_PARAM_HOLDER_TYPE ) {
100+ throw new \Exception ("Invalid parameter holder type " , static ::$ TRADER_ERR_INVALID_PARAM_HOLDER_TYPE );
101+ }
102+ if ($ ErrorCode === static ::$ TRADER_ERR_INVALID_PARAM_FUNCTION ) {
103+ throw new \Exception ("Invalid parameter function " , static ::$ TRADER_ERR_INVALID_PARAM_FUNCTION );
104+ }
105+ if ($ ErrorCode === static ::$ TRADER_ERR_INPUT_NOT_ALL_INITIALIZE ) {
106+ throw new \Exception ("Input not all initialized " , static ::$ TRADER_ERR_INPUT_NOT_ALL_INITIALIZE );
107+ }
108+ if ($ ErrorCode === static ::$ TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE ) {
109+ throw new \Exception ("Output not all initialized " , static ::$ TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE );
110+ }
111+ if ($ ErrorCode === static ::$ TRADER_ERR_OUT_OF_RANGE_START_INDEX ) {
112+ throw new \Exception ("Out of range on start index " , static ::$ TRADER_ERR_OUT_OF_RANGE_START_INDEX );
113+ }
114+ if ($ ErrorCode === static ::$ TRADER_ERR_OUT_OF_RANGE_END_INDEX ) {
115+ throw new \Exception ("Out of range on end index " , static ::$ TRADER_ERR_OUT_OF_RANGE_END_INDEX );
116+ }
117+ if ($ ErrorCode === static ::$ TRADER_ERR_INVALID_LIST_TYPE ) {
118+ throw new \Exception ("Invalid list type " , static ::$ TRADER_ERR_INVALID_LIST_TYPE );
119+ }
120+ if ($ ErrorCode === static ::$ TRADER_ERR_BAD_OBJECT ) {
121+ throw new \Exception ("Bad object " , static ::$ TRADER_ERR_BAD_OBJECT );
122+ }
123+ if ($ ErrorCode === static ::$ TRADER_ERR_NOT_SUPPORTED ) {
124+ throw new \Exception ("Not supported " , static ::$ TRADER_ERR_NOT_SUPPORTED );
125+ }
126+ if ($ ErrorCode === static ::$ TRADER_ERR_INTERNAL_ERROR ) {
127+ throw new \Exception ("Internal error " , static ::$ TRADER_ERR_INTERNAL_ERROR );
128+ }
129+ if ($ ErrorCode === static ::$ TRADER_ERR_UNKNOWN_ERROR ) {
130+ throw new \Exception ("Unknown error " , static ::$ TRADER_ERR_UNKNOWN_ERROR );
131+ }
132+
133+ }
134+
72135 /**
73136 * Calculates the arc cosine for each value in real and returns the resulting array.
74137 *
0 commit comments