NEST main@caf0ae8
 
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1/*
2 * exceptions.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef EXCEPTIONS_H
24#define EXCEPTIONS_H
25
26#include <exception>
27
28// C++ includes:
29#include <sstream>
30
31// Includes from nestkernel:
32#include "nest_time.h"
33
34// Includes from thirdparty:
35#include "compose.hpp"
36
37
38namespace nest
39{
40
41class Event;
42
64class KernelException : public std::runtime_error
65{
66public:
67 explicit KernelException()
68 : std::runtime_error( "" )
69 {
70 }
71
72 explicit KernelException( const std::string& msg )
73 : std::runtime_error( msg )
74 {
75 }
76
77 virtual std::string
79 {
80 return "KernelException";
81 }
82};
83
89{
90public:
91 explicit DynamicModuleManagementError( const std::string& msg )
92 : KernelException( msg )
93 {
94 }
95
96 std::string
97 exception_name() const override
98 {
99 return "DynamicModuleManagementError";
100 }
101};
102
108{
109public:
110 explicit NotImplemented( const std::string& msg )
111 : KernelException( msg )
112 {
113 }
114
115 std::string
116 exception_name() const override
117 {
118 return "NotImplemented";
119 }
120};
121
122
128{
129
130public:
131 explicit TypeMismatch()
132 : KernelException( "The expected datatype is unknown in the current context." )
133 {
134 }
135
136 explicit TypeMismatch( const std::string& expected )
137 : KernelException( "Expected datatype: " + expected )
138 {
139 }
140
141 explicit TypeMismatch( const std::string& expected, const std::string& provided )
142 : KernelException( "Expected datatype: " + expected + ", provided datatype: " + provided )
143 {
144 }
145
146 std::string
147 exception_name() const override
148 {
149 return "TypeMismatch";
150 }
151};
152
153
163{
164public:
165 UnaccessedDictionaryEntry( const std::string& what, const std::string& where, const std::string& missed )
166 : KernelException( "Unaccessed elements in " + what + ", in function " + where + ": " + missed )
167 {
168 }
169
170 std::string
171 exception_name() const override
172 {
173 return "UnaccessedDictionaryEntry";
174 }
175};
176
184{
185 std::string compose_msg_( const std::string& model_name ) const;
186
187public:
188 UnknownModelName( const std::string& model_name )
189 : KernelException( compose_msg_( model_name ) )
190 {
191 }
192
193 std::string
194 exception_name() const override
195 {
196 return "UnknownModelName";
197 }
198};
199
207{
208 std::string compose_msg_( const std::string& model_name ) const;
209
210public:
211 explicit UnknownComponent( const std::string& component_name )
212 : KernelException( compose_msg_( component_name ) )
213 {
214 }
215
216 std::string
217 exception_name() const override
218 {
219 return "UnknownComponent";
220 }
221};
222
229{
230 std::string compose_msg_( const std::string& model_name ) const;
231
232public:
233 NewModelNameExists( const std::string& model_name )
234 : KernelException( compose_msg_( model_name ) )
235 {
236 }
237
238 std::string
239 exception_name() const override
240 {
241 return "NewModelNameExists";
242 }
243};
244
253{
254 std::string compose_msg_( const std::string& model_name ) const;
255
256public:
257 ModelInUse( const std::string& model_name )
258 : KernelException( compose_msg_( model_name ) )
259 {
260 }
261
262 std::string
263 exception_name() const override
264 {
265 return "ModelInUse";
266 }
267};
268
275{
276 std::string compose_msg_( const int id ) const;
277 std::string compose_msg_( const std::string& name ) const;
278
279public:
282 {
283 }
284
285 UnknownSynapseType( std::string name )
286 : KernelException( compose_msg_( name ) )
287 {
288 }
289
290 std::string
291 exception_name() const override
292 {
293 return "UnknownSynapseType";
294 }
295};
296
306{
307 std::string compose_msg_( const int id ) const;
308
309public:
311 : KernelException( "UnknownNode" )
312 {
313 }
314
315 UnknownNode( int id )
317 {
318 }
319
320 std::string
321 exception_name() const override
322 {
323 return "UnknownNode";
324 }
325};
326
336{
337 std::string compose_msg_( const int id ) const;
338
339public:
341 : KernelException( "UnknownNode" )
342 {
343 }
344
347 {
348 }
349
350 std::string
351 exception_name() const override
352 {
353 return "NoThreadSiblingsAvailable";
354 }
355};
356
358{
359 std::string compose_msg_( const int id ) const;
360
361public:
364 {
365 }
366
367 std::string
368 exception_name() const override
369 {
370 return "LocalNodeExpected";
371 }
372};
373
375{
376 std::string compose_msg_( const int id ) const;
377
378public:
381 {
382 }
383
384 std::string
385 exception_name() const override
386 {
387 return "NodeWithProxiesExpected";
388 }
389};
390
391/*
392 * Exception to be thrown if the parent
393 * compartment does not exist
394 */
396{
397 std::string compose_msg_( const long compartment_idx, const std::string info ) const;
398
399public:
400 UnknownCompartment( long compartment_idx, std::string info )
401 : KernelException( compose_msg_( compartment_idx, info ) )
402 {
403 }
404
405 std::string
406 exception_name() const override
407 {
408 return "UnknownCompartment";
409 }
410};
411
417{
418 std::string compose_msg_( const long receptor_type, const std::string name ) const;
419
420public:
421 UnknownReceptorType( long receptor_type, std::string name )
422 : KernelException( compose_msg_( receptor_type, name ) )
423 {
424 }
425
426 std::string
427 exception_name() const override
428 {
429 return "UnknownReceptorType";
430 }
431};
432
438{
439 std::string compose_msg( const long receptor_type, const std::string name, const std::string event );
440
441public:
442 IncompatibleReceptorType( long receptor_type, std::string name, std::string event_type )
443 : KernelException( compose_msg( receptor_type, name, event_type ) )
444 {
445 }
446
447 std::string
448 exception_name() const override
449 {
450 return "IncompatibleReceptorType";
451 }
452};
453
461{
462 std::string compose_msg_( const int id ) const;
463 std::string compose_msg_( const int id, const std::string msg ) const;
464
465public:
466 UnknownPort( int id )
468 {
469 }
470
471 UnknownPort( int id, std::string msg )
472 : KernelException( compose_msg_( id, msg ) )
473 {
474 }
475
476 std::string
477 exception_name() const override
478 {
479 return "UnknownPort";
480 }
481};
482
490{
491public:
493 : KernelException( "Creation of connection is not possible." )
494 {
495 }
496
497 IllegalConnection( std::string msg )
498 : KernelException( "Creation of connection is not possible because:\n" + msg )
499 {
500 }
501
502 std::string
503 exception_name() const override
504 {
505 return "IllegalConnection";
506 }
507};
508
517{
518private:
519 std::string msg_;
520
521public:
523 : KernelException( "InexistentConnection" )
524 {
525 msg_ = "Deletion of connection is not possible because it does not exist.";
526 }
527
528 InexistentConnection( const std::string& msg )
529 : KernelException( "InexistentConnection" )
530 {
531 msg_ = "Deletion of connection is not possible because:\n";
532 msg_ += msg;
533 }
534
535 const char*
536 what() const noexcept override
537 {
538 return msg_.data();
539 };
540
541 std::string
542 exception_name() const override
543 {
544 return "InexistentConnection";
545 }
546};
547
553{
554private:
555 std::string msg_;
556
557public:
559 : KernelException( "UnknownThread" )
560 {
561 msg_ = String::compose( "Thread with id %1 is outside of range.", id );
562 }
563
564 const char*
565 what() const noexcept override
566 {
567 return msg_.data();
568 };
569
570 std::string
571 exception_name() const override
572 {
573 return "UnknownThread";
574 }
575};
576
583{
584private:
585 std::string msg_;
586
587public:
588 BadDelay( double delay, const std::string& msg )
589 : KernelException( "BadDelay" )
590 {
591 msg_ = String::compose( "Delay value %1 is invalid: %2", delay, msg );
592 }
593
594 const char*
595 what() const noexcept override
596 {
597 return msg_.data();
598 };
599
600 std::string
601 exception_name() const override
602 {
603 return "BadDelay";
604 }
605};
606
614{
615private:
616 std::string msg_;
617
618public:
620 : KernelException( "UnexpectedEvent" )
621 {
622 msg_ = "Target node cannot handle input event.\n";
623 msg_ += " A common cause for this is an attempt to connect recording devices incorrectly.\n";
624 msg_ += " Note that recorders such as spike recorders must be connected as\n\n";
625 msg_ += " nest.Connect(neurons, spike_det)\n\n";
626 msg_ += " while meters such as voltmeters must be connected as\n\n";
627 msg_ += " nest.Connect(meter, neurons) ";
628 }
629
630 UnexpectedEvent( const std::string& msg )
631 : KernelException( "UnexpectedEvent" )
632 {
633 msg_ = msg;
634 }
635
636 const char*
637 what() const noexcept override
638 {
639 return msg_.data();
640 };
641
642 std::string
643 exception_name() const override
644 {
645 return "UnexpectedEvent";
646 }
647};
648
649
657{
658 std::string compose_msg_() const;
659
660public:
665
666 std::string
667 exception_name() const override
668 {
669 return "UnsupportedEvent";
670 }
671};
672
680{
681private:
682 std::string msg_;
683
684public:
687 : KernelException( "BadProperty" )
688 , msg_()
689 {
690 }
691 BadProperty( std::string msg )
692 : KernelException( "BadProperty" )
693 , msg_( msg )
694 {
695 }
696
697 const char*
698 what() const noexcept override
699 {
700 return msg_.data();
701 };
702
703 std::string
704 exception_name() const override
705 {
706 return "BadProperty";
707 }
708};
709
717{
718private:
719 std::string msg_;
720
721public:
724 : KernelException( "BadParameter" )
725 , msg_()
726 {
727 }
728 BadParameter( std::string msg )
729 : KernelException( "BadParameter" )
730 , msg_( msg )
731 {
732 }
733
734 const char*
735 what() const noexcept override
736 {
737 return msg_.data();
738 };
739
740 std::string
741 exception_name() const override
742 {
743 return "BadParameter";
744 }
745};
746
752{
753 std::string msg_;
754
755public:
758 : KernelException( "BadParameterValue" )
759 , msg_()
760 {
761 }
762
763 BadParameterValue( std::string msg )
764 : KernelException( "BadParameterValue" )
765 , msg_( msg )
766 {
767 }
768
770 {
771 }
772
773 std::string
774 exception_name() const override
775 {
776 return "BadParameterValue";
777 }
778};
779
787{
788private:
789 std::string msg_;
790
791public:
793 : KernelException( "DimensionMismatch" )
794 {
795 msg_ = "Dimensions of two or more variables do not match.";
796 }
797
798 DimensionMismatch( int expected, int provided )
799 : KernelException( "DimensionMismatch" )
800 {
801 msg_ = String::compose( "Expected dimension size: %1 Provided dimension size: %2.", expected, provided );
802 }
803
804 DimensionMismatch( const std::string& msg )
805 : KernelException( "DimensionMismatch" )
806 {
807 msg_ = msg;
808 }
809
810 const char*
811 what() const noexcept override
812 {
813 return msg_.data();
814 };
815
816 std::string
817 exception_name() const override
818 {
819 return "DimensionMismatch";
820 }
821};
822
829{
830public:
832 : KernelException( "DistributionError" )
833 {
834 }
835
836 std::string
837 exception_name() const override
838 {
839 return "DistributionError";
840 }
841};
842
851{
852private:
853 std::string msg_;
854
855public:
863 InvalidDefaultResolution( const std::string& model, const std::string& property, const Time& value )
864 : KernelException( "InvalidDefaultResolution" )
865 {
866 std::ostringstream oss;
867 oss << "The default resolution of " << Time::get_resolution() << " is not consistent with the value " << value
868 << " of property '" << property << "' in model " << model << ".\n"
869 << "This is an internal NEST error, please report it at https://github.com/nest/nest-simulator/issues";
870
871 msg_ = oss.str();
872 }
873
874 const char*
875 what() const noexcept override
876 {
877 return msg_.data();
878 };
879
880 std::string
881 exception_name() const override
882 {
883 return "InvalidDefaultResolution";
884 }
885};
886
895{
896private:
897 std::string msg_;
898
899public:
907 InvalidTimeInModel( const std::string& model, const std::string& property, const Time& value )
908 : KernelException( "InvalidTimeInModel" )
909 {
910 std::ostringstream oss;
911 oss << "The time property " << property << " = " << value << " of model " << model
912 << " is not compatible with the resolution " << Time::get_resolution() << ".\n"
913 << "Please set a compatible value with SetDefaults!";
914
915 msg_ = oss.str();
916 }
917
918 const char*
919 what() const noexcept override
920 {
921 return msg_.data();
922 };
923
924 std::string
925 exception_name() const override
926 {
927 return "InvalidTimeInModel";
928 }
929};
930
937{
938private:
939 std::string msg_;
940
941public:
949 StepMultipleRequired( const std::string& model, const std::string& property, const Time& value )
950 : KernelException( "StepMultipleRequired" )
951 {
952 std::ostringstream oss;
953 oss << "The time property " << property << " = " << value << " of model " << model
954 << " must be a multiple of the resolution " << Time::get_resolution() << ".";
955
956 msg_ = oss.str();
957 }
958
959 const char*
960 what() const noexcept override
961 {
962 return msg_.data();
963 };
964
965 std::string
966 exception_name() const override
967 {
968 return "StepMultipleRequired";
969 }
970};
971
978{
979private:
980 std::string msg_;
981
982public:
992 TimeMultipleRequired( const std::string& model,
993 const std::string& name_a,
994 const Time& value_a,
995 const std::string& name_b,
996 const Time& value_b )
997 : KernelException( "StepMultipleRequired" )
998 {
999 std::ostringstream oss;
1000 oss << "In model " << model << ", the time property " << name_a << " = " << value_a
1001 << " must be multiple of time property " << name_b << " = " << value_b << '.';
1002
1003 msg_ = oss.str();
1004 }
1005
1006 const char*
1007 what() const noexcept override
1008 {
1009 return msg_.data();
1010 };
1011
1012 std::string
1013 exception_name() const override
1014 {
1015 return "TimeMultipleRequired";
1016 }
1017};
1018
1024{
1025private:
1026 std::string msg_;
1027
1028public:
1035 GSLSolverFailure( const std::string& model, const int status )
1036 : KernelException( "GSLSolverFailure" )
1037 {
1038 msg_ = String::compose(
1039 "In model %1 the GSL solver returned with exit status %2.\n"
1040 "Please make sure you have installed a recent GSL version (> gsl-1.10).",
1041 model,
1042 status );
1043 }
1044
1045 const char*
1046 what() const noexcept override
1047 {
1048 return msg_.data();
1049 };
1050
1051 std::string
1052 exception_name() const override
1053 {
1054 return "GSLSolverFailure";
1055 }
1056};
1057
1063{
1064private:
1065 std::string msg_;
1066
1067public:
1073 NumericalInstability( const std::string& model )
1074 : KernelException( "NumericalInstability" )
1075 {
1076 msg_ = String::compose( "NEST detected a numerical instability while updating %1.", model );
1077 }
1078
1079 const char*
1080 what() const noexcept override
1081 {
1082 return msg_.data();
1083 };
1084
1085 std::string
1086 exception_name() const override
1087 {
1088 return "NumericalInstability";
1089 }
1090};
1091
1099{
1100private:
1101 std::string msg_;
1102
1103public:
1104 NamingConflict( const std::string& msg )
1105 : KernelException( "NamingConflict" )
1106 , msg_( msg )
1107 {
1108 }
1109
1110 const char*
1111 what() const noexcept override
1112 {
1113 return msg_.data();
1114 };
1115
1116 std::string
1117 exception_name() const override
1118 {
1119 return "NamingConflict";
1120 }
1121};
1122
1128{
1129private:
1130 std::string msg_;
1131
1132public:
1133 RangeCheck( const size_t expected_size )
1134 : KernelException( "RangeCheck" )
1135 , msg_( String::compose( "Array with length %1 expected.", expected_size ) )
1136 {
1137 }
1138
1139 const char*
1140 what() const noexcept override
1141 {
1142 return msg_.data();
1143 };
1144
1145 std::string
1146 exception_name() const override
1147 {
1148 return "RangeCheck";
1149 }
1150};
1151
1157{
1158private:
1159 std::string msg_;
1160
1161public:
1163 : KernelException( "IOError" )
1164 {
1165 msg_ = "";
1166 }
1167
1168 const char*
1169 what() const noexcept override
1170 {
1171 return msg_.data();
1172 };
1173
1174 std::string
1175 exception_name() const override
1176 {
1177 return "IOError";
1178 }
1179};
1180
1187{
1188private:
1189 std::string msg_;
1190
1191public:
1192 KeyError( const std::string& key, const std::string& map_type, const std::string& map_op )
1193 : KernelException( "KeyError" )
1194 {
1195 msg_ = String::compose(
1196 "Key '%1' not found in map. Error encountered with map type: '%2' when applying operation: '%3'.",
1197 key,
1198 map_type,
1199 map_op );
1200 }
1201
1202 const char*
1203 what() const noexcept override
1204 {
1205 return msg_.data();
1206 };
1207
1208 std::string
1209 exception_name() const override
1210 {
1211 return "KeyError";
1212 }
1213};
1214
1220{
1221private:
1222 std::string msg_;
1223
1224public:
1227 : KernelException()
1228 , msg_( "InternalError" )
1229 {
1230 }
1231
1232 InternalError( std::string msg )
1233 : KernelException( msg )
1234 {
1235 }
1236
1237 const char*
1238 what() const noexcept override
1239 {
1240 return msg_.data();
1241 };
1242
1243 std::string
1244 exception_name() const override
1245 {
1246 return "InternalError";
1247 }
1248};
1249
1250#ifdef HAVE_MUSIC
1256class MUSICPortUnconnected : public KernelException
1257{
1258private:
1259 std::string msg_;
1260
1261public:
1268 MUSICPortUnconnected( const std::string& model, const std::string& portname )
1269 : KernelException( "MUSICPortUnconnected" )
1270 {
1271 msg_ = String::compose(
1272 "Cannot use instance of model %1 because the MUSIC "
1273 "port %2 is unconnected.",
1274 model,
1275 portname );
1276 }
1277
1278 const char*
1279 what() const noexcept override
1280 {
1281 return msg_.data();
1282 };
1283
1284 std::string
1285 exception_name() const override
1286 {
1287 return "MUSICPortUnconnected";
1288 }
1289};
1290
1291
1297class MUSICPortHasNoWidth : public KernelException
1298{
1299private:
1300 std::string msg_;
1301
1302public:
1309 MUSICPortHasNoWidth( const std::string& model, const std::string& portname )
1310 : KernelException( "MUSICPortHasNoWidth" )
1311 {
1312 msg_ = String::compose(
1313 "Cannot use instance of model %1 because the MUSIC "
1314 "port %2 has no width specified in configuration file.",
1315 model,
1316 portname );
1317 }
1318
1319 const char*
1320 what() const noexcept override
1321 {
1322 return msg_.data();
1323 };
1324
1325 std::string
1326 exception_name() const override
1327 {
1328 return "MUSICPortHasNoWidth";
1329 }
1330};
1331
1337class MUSICPortAlreadyPublished : public KernelException
1338{
1339private:
1340 std::string msg_;
1341
1342public:
1349 MUSICPortAlreadyPublished( const std::string& model, const std::string& portname )
1350 : KernelException( "MUSICPortAlreadyPublished" )
1351 {
1352 msg_ = String::compose(
1353 "The instance of model %1 cannot change the MUSIC "
1354 "port / establish connections %2 since it is already published.",
1355 model,
1356 portname );
1357 }
1358
1359 const char*
1360 what() const noexcept override
1361 {
1362 return msg_.data();
1363 };
1364
1365 std::string
1366 exception_name() const override
1367 {
1368 return "MUSICPortAlreadyPublished";
1369 }
1370};
1371
1377class MUSICSimulationHasRun : public KernelException
1378{
1379private:
1380 std::string msg_;
1381
1382public:
1388 MUSICSimulationHasRun( const std::string& model )
1389 : KernelException( "MUSICSimulationHasRun" )
1390 {
1391 msg_ = String::compose(
1392 "The instance of model %1 won't work, since the simulation "
1393 "has already been running",
1394 model );
1395 }
1396
1397 const char*
1398 what() const noexcept override
1399 {
1400 return msg_.data();
1401 };
1402
1403 std::string
1404 exception_name() const override
1405 {
1406 return "MUSICSimulationHasRun";
1407 }
1408};
1409
1415class MUSICChannelUnknown : public KernelException
1416{
1417private:
1418 std::string msg_;
1419
1420public:
1428 MUSICChannelUnknown( const std::string& model, const std::string& portname, int channel )
1429 : KernelException( "MUSICChannelUnknown" )
1430 {
1431 msg_ = String::compose(
1432 "The port %1 cannot be mapped in %2 because the channel %3 "
1433 "does not exist.",
1434 portname,
1435 model,
1436 channel );
1437 }
1438
1439 const char*
1440 what() const noexcept override
1441 {
1442 return msg_.data();
1443 };
1444
1445 std::string
1446 exception_name() const override
1447 {
1448 return "MUSICChannelUnknown";
1449 }
1450};
1451
1457class MUSICPortUnknown : public KernelException
1458{
1459private:
1460 std::string msg_;
1461
1465public:
1466 MUSICPortUnknown( const std::string& portname )
1467 : KernelException( "MUSICPortUnknown" )
1468 {
1469 msg_ = String::compose( "The port %1 does not exist.", portname );
1470 }
1471
1472 const char*
1473 what() const noexcept override
1474 {
1475 return msg_.data();
1476 };
1477
1478 std::string
1479 exception_name() const override
1480 {
1481 return "MUSICPortUnknown";
1482 }
1483};
1484
1490class MUSICChannelAlreadyMapped : public KernelException
1491{
1492private:
1493 std::string msg_;
1494
1495public:
1503 MUSICChannelAlreadyMapped( const std::string& model, const std::string& portname, int channel )
1504 : KernelException( "MUSICChannelAlreadyMapped" )
1505 {
1506 msg_ = String::compose(
1507 "The channel %1 of port %2 has already be mapped "
1508 "to another proxy in %3.",
1509 channel,
1510 portname,
1511 model );
1512 }
1513
1514 const char*
1515 what() const noexcept override
1516 {
1517 return msg_.data();
1518 };
1519
1520 std::string
1521 exception_name() const override
1522 {
1523 return "MUSICChannelAlreadyMapped";
1524 }
1525};
1526#endif // HAVE_MUSIC
1527
1528#ifdef HAVE_MPI
1529class MPIPortsFileUnknown : public KernelException
1530{
1531private:
1532 std::string msg_;
1533
1534public:
1535 explicit MPIPortsFileUnknown( const size_t node_id )
1536 {
1537 msg_ = String::compose(
1538 "The node with ID %1 requires a label, which specifies the "
1539 "folder with files containing the MPI ports.",
1540 node_id );
1541 }
1542
1543 const char*
1544 what() const noexcept override
1545 {
1546 return msg_.data();
1547 };
1548
1549 std::string
1550 exception_name() const override
1551 {
1552 return "MPIPortsUnknown";
1553 }
1554};
1555
1556class MPIPortsFileMissing : public KernelException
1557{
1558private:
1559 std::string msg_;
1560
1561public:
1562 explicit MPIPortsFileMissing( const size_t node_id, const std::string path )
1563 {
1564 msg_ = String::compose(
1565 "The node with ID %1 expects a file with the MPI address at location %2. "
1566 "The file does not seem to exist.",
1567 node_id,
1568 path );
1569 }
1570
1571 const char*
1572 what() const noexcept override
1573 {
1574 return msg_.data();
1575 };
1576
1577 std::string
1578 exception_name() const override
1579 {
1580 return "MPIPortsFileMissing";
1581 }
1582};
1583
1584class MPIErrorCode : public KernelException
1585{
1586private:
1587 std::string msg_;
1588
1589public:
1590 explicit MPIErrorCode( const int error_code );
1591
1592 const char*
1593 what() const noexcept override
1594 {
1595 return msg_.data();
1596 };
1597
1598 std::string
1599 exception_name() const override
1600 {
1601 return "MPIErrorCode";
1602 }
1603};
1604#endif // HAVE_MPI
1605
1607{
1608private:
1609 std::string msg_;
1610
1611public:
1612 UnmatchedSteps( int steps_left, int total_steps )
1613 : KernelException( "UnmatchedSteps" )
1614 {
1615 msg_ = String::compose(
1616 "Steps for backend device don't match NEST steps: "
1617 "steps expected: %1 steps executed: %2.",
1618 total_steps,
1619 total_steps - steps_left );
1620 }
1621
1622 const char*
1623 what() const noexcept override
1624 {
1625 return msg_.data();
1626 };
1627
1628 std::string
1629 exception_name() const override
1630 {
1631 return "UnmatchedSteps";
1632 }
1633};
1634
1636{
1637private:
1638 const std::string backend_;
1639 std::string msg_;
1640
1641public:
1642 BackendPrepared( const std::string& backend )
1643 : KernelException( "BackendPrepared" )
1644 , backend_( backend )
1645 {
1646 msg_ = String::compose( "Backend %1 may not be prepare()'d multiple times.", backend_ );
1647 }
1648
1649 BackendPrepared( std::string&& backend )
1650 : KernelException( "BackendPrepared" )
1651 , backend_( std::move( backend ) )
1652 {
1653 msg_ = String::compose( "Backend %1 may not be prepare()'d multiple times.", backend_ );
1654 }
1655
1656 const char*
1657 what() const noexcept override
1658 {
1659 return msg_.data();
1660 };
1661
1662 std::string
1663 exception_name() const override
1664 {
1665 return "BackendPrepared";
1666 }
1667};
1668
1670{
1671private:
1672 const std::string backend_;
1673 std::string msg_;
1674
1675public:
1676 BackendAlreadyRegistered( const std::string& backend )
1677 : KernelException( "BackendPrepared" )
1678 , backend_( backend )
1679 {
1680 msg_ = String::compose( "Backend %1 has already been registered.", backend_ );
1681 }
1682
1683 BackendAlreadyRegistered( std::string&& backend )
1684 : KernelException( "BackendPrepared" )
1685 , backend_( std::move( backend ) )
1686 {
1687 msg_ = String::compose( "Backend %1 has already been registered.", backend_ );
1688 }
1689
1690 const char*
1691 what() const noexcept override
1692 {
1693 return msg_.data();
1694 };
1695
1696 std::string
1697 exception_name() const override
1698 {
1699 return "BackendAlreadyRegistered";
1700 }
1701};
1702
1703
1705{
1706private:
1707 const std::string backend_;
1708 std::string msg_;
1709
1710public:
1711 BackendNotPrepared( const std::string& backend )
1712 : KernelException( "BackendNotPrepared" )
1713 , backend_( backend )
1714 {
1715 msg_ = String::compose(
1716 "Backend %1 may not be cleanup()'d "
1717 "without preparation (multiple cleanups?).",
1718 backend_ );
1719 }
1720
1721 BackendNotPrepared( std::string&& backend )
1722 : KernelException( "BackendNotPrepared" )
1723 , backend_( std::move( backend ) )
1724 {
1725 msg_ = String::compose(
1726 "Backend %1 may not be cleanup()'d "
1727 "without preparation (multiple cleanups?).",
1728 backend_ );
1729 }
1730
1731 const char*
1732 what() const noexcept override
1733 {
1734 return msg_.data();
1735 };
1736
1737 std::string
1738 exception_name() const override
1739 {
1740 return "BackendNotPrepared";
1741 }
1742};
1743
1745{
1746public:
1748 : KernelException( "LayerExpected" )
1749 {
1750 }
1751
1752 std::string
1753 exception_name() const override
1754 {
1755 return "LayerExpected";
1756 }
1757};
1758
1760{
1761public:
1763 : KernelException( "LayerNodeExpected" )
1764 {
1765 }
1766
1767 std::string
1768 exception_name() const override
1769 {
1770 return "LayerNodeExpected";
1771 }
1772};
1773
1775{
1776private:
1777 std::string msg_;
1778
1779public:
1780 UndefinedName( std::string name )
1781 : KernelException( "UndefinedName" )
1782 {
1783 msg_ = String::compose( "The name %1 is not defined.", name );
1784 }
1785
1786 const char*
1787 what() const noexcept override
1788 {
1789 return msg_.data();
1790 };
1791
1792 std::string
1793 exception_name() const override
1794 {
1795 return "UndefinedName";
1796 }
1797};
1798
1799} // namespace nest
1800#endif // EXCEPTIONS_H
Definition exceptions.h:1670
const std::string backend_
Definition exceptions.h:1672
BackendAlreadyRegistered(std::string &&backend)
Definition exceptions.h:1683
const char * what() const noexcept override
Definition exceptions.h:1691
BackendAlreadyRegistered(const std::string &backend)
Definition exceptions.h:1676
std::string msg_
Definition exceptions.h:1673
std::string exception_name() const override
Definition exceptions.h:1697
Definition exceptions.h:1705
BackendNotPrepared(std::string &&backend)
Definition exceptions.h:1721
const char * what() const noexcept override
Definition exceptions.h:1732
BackendNotPrepared(const std::string &backend)
Definition exceptions.h:1711
const std::string backend_
Definition exceptions.h:1707
std::string msg_
Definition exceptions.h:1708
std::string exception_name() const override
Definition exceptions.h:1738
Definition exceptions.h:1636
std::string msg_
Definition exceptions.h:1639
std::string exception_name() const override
Definition exceptions.h:1663
const char * what() const noexcept override
Definition exceptions.h:1657
const std::string backend_
Definition exceptions.h:1638
BackendPrepared(const std::string &backend)
Definition exceptions.h:1642
BackendPrepared(std::string &&backend)
Definition exceptions.h:1649
Exception to be thrown if an invalid delay is used in a connection.
Definition exceptions.h:583
const char * what() const noexcept override
Definition exceptions.h:595
std::string msg_
Definition exceptions.h:585
std::string exception_name() const override
Definition exceptions.h:601
BadDelay(double delay, const std::string &msg)
Definition exceptions.h:588
Exception to be thrown if a parameter value is not acceptable.
Definition exceptions.h:752
~BadParameterValue()
Definition exceptions.h:769
std::string exception_name() const override
Definition exceptions.h:774
std::string msg_
Definition exceptions.h:753
BadParameterValue()
Definition exceptions.h:757
BadParameterValue(std::string msg)
Definition exceptions.h:763
Exception to be thrown if a parameter cannot be set.
Definition exceptions.h:717
BadParameter()
Definition exceptions.h:723
std::string msg_
Definition exceptions.h:719
std::string exception_name() const override
Definition exceptions.h:741
const char * what() const noexcept override
Definition exceptions.h:735
BadParameter(std::string msg)
Definition exceptions.h:728
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
BadProperty()
Definition exceptions.h:686
const char * what() const noexcept override
Definition exceptions.h:698
std::string msg_
Definition exceptions.h:682
BadProperty(std::string msg)
Definition exceptions.h:691
std::string exception_name() const override
Definition exceptions.h:704
Exception to be thrown if the dimensions of two or more objects do not agree.
Definition exceptions.h:787
DimensionMismatch()
Definition exceptions.h:792
DimensionMismatch(const std::string &msg)
Definition exceptions.h:804
DimensionMismatch(int expected, int provided)
Definition exceptions.h:798
std::string exception_name() const override
Definition exceptions.h:817
std::string msg_
Definition exceptions.h:789
const char * what() const noexcept override
Definition exceptions.h:811
Exception to be thrown if a problem with the distribution of elements is encountered.
Definition exceptions.h:829
std::string exception_name() const override
Definition exceptions.h:837
DistributionError()
Definition exceptions.h:831
Exception to be thrown if loading or unloading a dynamically loaded module fails.
Definition exceptions.h:89
DynamicModuleManagementError(const std::string &msg)
Definition exceptions.h:91
std::string exception_name() const override
Definition exceptions.h:97
Exception to be thrown if a GSL solver does not return GSL_SUCCESS.
Definition exceptions.h:1024
const char * what() const noexcept override
Definition exceptions.h:1046
std::string msg_
Definition exceptions.h:1026
std::string exception_name() const override
Definition exceptions.h:1052
GSLSolverFailure(const std::string &model, const int status)
Definition exceptions.h:1035
Exception to be thrown if an error occured in an I/O operation.
Definition exceptions.h:1157
std::string exception_name() const override
Definition exceptions.h:1175
std::string msg_
Definition exceptions.h:1159
IOError()
Definition exceptions.h:1162
const char * what() const noexcept override
Definition exceptions.h:1169
To be thrown if a connection is not possible.
Definition exceptions.h:490
std::string exception_name() const override
Definition exceptions.h:503
IllegalConnection()
Definition exceptions.h:492
IllegalConnection(std::string msg)
Definition exceptions.h:497
Exception to be thrown if the specified receptor type does not accept the event type.
Definition exceptions.h:438
std::string compose_msg(const long receptor_type, const std::string name, const std::string event)
Definition exceptions.cpp:140
std::string exception_name() const override
Definition exceptions.h:448
IncompatibleReceptorType(long receptor_type, std::string name, std::string event_type)
Definition exceptions.h:442
To be thrown if a connection does not exists but something is to be done with it.
Definition exceptions.h:517
const char * what() const noexcept override
Definition exceptions.h:536
InexistentConnection(const std::string &msg)
Definition exceptions.h:528
std::string exception_name() const override
Definition exceptions.h:542
std::string msg_
Definition exceptions.h:519
InexistentConnection()
Definition exceptions.h:522
Exception to be thrown if an internal error occurs.
Definition exceptions.h:1220
const char * what() const noexcept override
Definition exceptions.h:1238
std::string msg_
Definition exceptions.h:1222
InternalError()
Definition exceptions.h:1226
std::string exception_name() const override
Definition exceptions.h:1244
InternalError(std::string msg)
Definition exceptions.h:1232
Exception to be thrown on prototype construction if Time objects incompatible.
Definition exceptions.h:851
std::string exception_name() const override
Definition exceptions.h:881
std::string msg_
Definition exceptions.h:853
const char * what() const noexcept override
Definition exceptions.h:875
InvalidDefaultResolution(const std::string &model, const std::string &property, const Time &value)
Definition exceptions.h:863
Exception to be thrown on instance construction if Time objects incompatible.
Definition exceptions.h:895
const char * what() const noexcept override
Definition exceptions.h:919
std::string exception_name() const override
Definition exceptions.h:925
std::string msg_
Definition exceptions.h:897
InvalidTimeInModel(const std::string &model, const std::string &property, const Time &value)
Definition exceptions.h:907
Base class for all Kernel exceptions.
Definition exceptions.h:65
virtual std::string exception_name() const
Definition exceptions.h:78
KernelException(const std::string &msg)
Definition exceptions.h:72
KernelException()
Definition exceptions.h:67
Exception to be thrown if when trying to delete an entry from DynamicRecordablesMap that does not exi...
Definition exceptions.h:1187
KeyError(const std::string &key, const std::string &map_type, const std::string &map_op)
Definition exceptions.h:1192
std::string exception_name() const override
Definition exceptions.h:1209
const char * what() const noexcept override
Definition exceptions.h:1203
std::string msg_
Definition exceptions.h:1189
Definition exceptions.h:1745
std::string exception_name() const override
Definition exceptions.h:1753
LayerExpected()
Definition exceptions.h:1747
Definition exceptions.h:1760
std::string exception_name() const override
Definition exceptions.h:1768
LayerNodeExpected()
Definition exceptions.h:1762
Definition exceptions.h:358
std::string exception_name() const override
Definition exceptions.h:368
std::string compose_msg_(const int id) const
Definition exceptions.cpp:109
LocalNodeExpected(int id)
Definition exceptions.h:362
Exception to be thrown if a (neuron/synapse) model with the the specified ID is used within the netwo...
Definition exceptions.h:253
ModelInUse(const std::string &model_name)
Definition exceptions.h:257
std::string exception_name() const override
Definition exceptions.h:263
std::string compose_msg_(const std::string &model_name) const
Definition exceptions.cpp:74
Throw if an existing name is attempted to be redefined.
Definition exceptions.h:1099
NamingConflict(const std::string &msg)
Definition exceptions.h:1104
const char * what() const noexcept override
Definition exceptions.h:1111
std::string msg_
Definition exceptions.h:1101
std::string exception_name() const override
Definition exceptions.h:1117
Exception to be thrown if a name requested for a user-defined model exist already.
Definition exceptions.h:229
std::string compose_msg_(const std::string &model_name) const
Definition exceptions.cpp:67
NewModelNameExists(const std::string &model_name)
Definition exceptions.h:233
std::string exception_name() const override
Definition exceptions.h:239
Exception to be thrown if the specified Node does not exist.
Definition exceptions.h:336
std::string exception_name() const override
Definition exceptions.h:351
std::string compose_msg_(const int id) const
Definition exceptions.cpp:102
NoThreadSiblingsAvailable()
Definition exceptions.h:340
NoThreadSiblingsAvailable(int id)
Definition exceptions.h:345
Definition exceptions.h:375
std::string compose_msg_(const int id) const
Definition exceptions.cpp:116
std::string exception_name() const override
Definition exceptions.h:385
NodeWithProxiesExpected(int id)
Definition exceptions.h:379
Exception to be thrown if a feature is unavailable.
Definition exceptions.h:108
std::string exception_name() const override
Definition exceptions.h:116
NotImplemented(const std::string &msg)
Definition exceptions.h:110
Exception to be thrown if numerical instabilities are detected.
Definition exceptions.h:1063
const char * what() const noexcept override
Definition exceptions.h:1080
std::string exception_name() const override
Definition exceptions.h:1086
NumericalInstability(const std::string &model)
Definition exceptions.h:1073
std::string msg_
Definition exceptions.h:1065
Exception to be thrown if a given array has the wrong size.
Definition exceptions.h:1128
RangeCheck(const size_t expected_size)
Definition exceptions.h:1133
const char * what() const noexcept override
Definition exceptions.h:1140
std::string exception_name() const override
Definition exceptions.h:1146
std::string msg_
Definition exceptions.h:1130
Exception to be thrown if a Time object should be multiple of the resolution.
Definition exceptions.h:937
std::string exception_name() const override
Definition exceptions.h:966
StepMultipleRequired(const std::string &model, const std::string &property, const Time &value)
Definition exceptions.h:949
const char * what() const noexcept override
Definition exceptions.h:960
std::string msg_
Definition exceptions.h:939
Exception to be thrown if a Time object should be a multiple of another.
Definition exceptions.h:978
std::string exception_name() const override
Definition exceptions.h:1013
const char * what() const noexcept override
Definition exceptions.h:1007
TimeMultipleRequired(const std::string &model, const std::string &name_a, const Time &value_a, const std::string &name_b, const Time &value_b)
Definition exceptions.h:992
std::string msg_
Definition exceptions.h:980
Definition nest_time.h:135
static Time get_resolution()
Definition nest_time.h:325
Exception to be thrown if a given type does not match the expected type.
Definition exceptions.h:128
std::string exception_name() const override
Definition exceptions.h:147
TypeMismatch(const std::string &expected)
Definition exceptions.h:136
TypeMismatch(const std::string &expected, const std::string &provided)
Definition exceptions.h:141
TypeMismatch()
Definition exceptions.h:131
Not all elements in a Dictionary have been accessed.
Definition exceptions.h:163
UnaccessedDictionaryEntry(const std::string &what, const std::string &where, const std::string &missed)
Definition exceptions.h:165
std::string exception_name() const override
Definition exceptions.h:171
Definition exceptions.h:1775
const char * what() const noexcept override
Definition exceptions.h:1787
UndefinedName(std::string name)
Definition exceptions.h:1780
std::string exception_name() const override
Definition exceptions.h:1793
std::string msg_
Definition exceptions.h:1777
Exception to be thrown by the event handler of a node if it receives an event it cannot handle.
Definition exceptions.h:614
UnexpectedEvent(const std::string &msg)
Definition exceptions.h:630
std::string exception_name() const override
Definition exceptions.h:643
const char * what() const noexcept override
Definition exceptions.h:637
std::string msg_
Definition exceptions.h:616
UnexpectedEvent()
Definition exceptions.h:619
Definition exceptions.h:396
std::string exception_name() const override
Definition exceptions.h:406
UnknownCompartment(long compartment_idx, std::string info)
Definition exceptions.h:400
std::string compose_msg_(const long compartment_idx, const std::string info) const
Definition exceptions.cpp:126
Exception to be thrown if a component with the the specified name does not exist.
Definition exceptions.h:207
UnknownComponent(const std::string &component_name)
Definition exceptions.h:211
std::string compose_msg_(const std::string &model_name) const
Definition exceptions.cpp:55
std::string exception_name() const override
Definition exceptions.h:217
Exception to be thrown if a model with the the specified name does not exist.
Definition exceptions.h:184
std::string exception_name() const override
Definition exceptions.h:194
UnknownModelName(const std::string &model_name)
Definition exceptions.h:188
std::string compose_msg_(const std::string &model_name) const
Definition exceptions.cpp:43
Exception to be thrown if the specified Node does not exist.
Definition exceptions.h:306
UnknownNode(int id)
Definition exceptions.h:315
UnknownNode()
Definition exceptions.h:310
std::string exception_name() const override
Definition exceptions.h:321
std::string compose_msg_(const int id) const
Definition exceptions.cpp:95
To be thrown if a port does not exists.
Definition exceptions.h:461
UnknownPort(int id)
Definition exceptions.h:466
UnknownPort(int id, std::string msg)
Definition exceptions.h:471
std::string compose_msg_(const int id) const
Definition exceptions.cpp:147
std::string exception_name() const override
Definition exceptions.h:477
Exception to be thrown if the specified receptor type does not exist in the node.
Definition exceptions.h:417
std::string compose_msg_(const long receptor_type, const std::string name) const
Definition exceptions.cpp:133
UnknownReceptorType(long receptor_type, std::string name)
Definition exceptions.h:421
std::string exception_name() const override
Definition exceptions.h:427
Exception to be thrown if the specified Synapse type does not exist.
Definition exceptions.h:275
UnknownSynapseType(int id)
Definition exceptions.h:280
std::string compose_msg_(const int id) const
Definition exceptions.cpp:81
UnknownSynapseType(std::string name)
Definition exceptions.h:285
std::string exception_name() const override
Definition exceptions.h:291
Exception to be thrown if a thread id outside the range encountered.
Definition exceptions.h:553
UnknownThread(int id)
Definition exceptions.h:558
std::string exception_name() const override
Definition exceptions.h:571
std::string msg_
Definition exceptions.h:555
const char * what() const noexcept override
Definition exceptions.h:565
Definition exceptions.h:1607
std::string msg_
Definition exceptions.h:1609
std::string exception_name() const override
Definition exceptions.h:1629
const char * what() const noexcept override
Definition exceptions.h:1623
UnmatchedSteps(int steps_left, int total_steps)
Definition exceptions.h:1612
Exception to be thrown by a Connection object if a connection with an unsupported event type is attem...
Definition exceptions.h:657
std::string compose_msg_() const
Definition exceptions.cpp:163
std::string exception_name() const override
Definition exceptions.h:667
UnsupportedEvent()
Definition exceptions.h:661
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33