Overview
Comment: | Adjust exceptions to recent change to +[className]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a655029b6d07f87b3f0bfbc7b09b9ec8 |
User & Date: | js on 2010-12-20 21:39:37 |
Other Links: | manifest | tags |
Context
2010-12-20
| ||
21:41 | Add +[changeToDirectory:] to OFFile. check-in: 4cf3648097 user: js tags: trunk | |
21:39 | Adjust exceptions to recent change to +[className]. check-in: a655029b6d user: js tags: trunk | |
17:42 | Add -fobjc-exceptions to objfw-config. check-in: c5937c3e79 user: js tags: trunk | |
Changes
Modified src/OFExceptions.m from [250b6ae1fd] to [f318889e33].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) # import <objc/runtime.h> #endif #ifdef OF_OLD_GNU_RUNTIME # import <objc/objc-api.h> # define sel_getName(x) sel_get_name(x) #endif #import "OFExceptions.h" #import "OFString.h" #import "OFTCPSocket.h" #ifndef _WIN32 | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) # import <objc/runtime.h> #endif #ifdef OF_OLD_GNU_RUNTIME # import <objc/objc-api.h> # define sel_getName(x) sel_get_name(x) # define class_getName class_get_class_name #endif #import "OFExceptions.h" #import "OFString.h" #import "OFTCPSocket.h" #ifndef _WIN32 |
︙ | ︙ | |||
211 212 213 214 215 216 217 | { if (description != nil) return description; if (requestedSize) description = [[OFString alloc] initWithFormat: @"Could not allocate %zu bytes in class %s!", requestedSize, | | | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | { if (description != nil) return description; if (requestedSize) description = [[OFString alloc] initWithFormat: @"Could not allocate %zu bytes in class %s!", requestedSize, class_getName(inClass)]; else description = [[OFString alloc] initWithFormat: @"Could not allocate enough memory in class %s!", class_getName(inClass)]; return description; } - (size_t)requestedSize { return requestedSize; } @end @implementation OFEnumerationMutationException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Object of class %s was mutated during enumeration!", class_getName(inClass)]; return description; } @end @implementation OFMemoryNotPartOfObjectException + newWithClass: (Class)class_ |
︙ | ︙ | |||
275 276 277 278 279 280 281 | if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Memory at %p was not allocated as part of object of class %s, " @"thus the memory allocation was not changed! It is also possible " @"that there was an attempt to free the same memory twice.", | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Memory at %p was not allocated as part of object of class %s, " @"thus the memory allocation was not changed! It is also possible " @"that there was an attempt to free the same memory twice.", pointer, class_getName(inClass)]; return description; } - (void*)pointer { return pointer; |
︙ | ︙ | |||
319 320 321 322 323 324 325 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The method %s of class %s is not or not fully implemented!", | | | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The method %s of class %s is not or not fully implemented!", sel_getName(selector), class_getName(inClass)]; return description; } - (SEL)selector { return selector; } @end @implementation OFOutOfRangeException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Value out of range in class %s!", class_getName(inClass)]; return description; } @end @implementation OFInvalidArgumentException + newWithClass: (Class)class_ |
︙ | ︙ | |||
376 377 378 379 380 381 382 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The argument for method %s of class %s is invalid!", | | | | | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The argument for method %s of class %s is invalid!", sel_getName(selector), class_getName(inClass)]; return description; } - (SEL)selector { return selector; } @end @implementation OFInvalidEncodingException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The encoding is invalid for class %s!", class_getName(inClass)]; return description; } @end @implementation OFInvalidFormatException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The format is invalid for class %s!", class_getName(inClass)]; return description; } @end @implementation OFMalformedXMLException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The parser in class %s encountered malformed or invalid XML!", class_getName(inClass)]; return description; } @end @implementation OFInitializationFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Initialization failed for class %s!", class_getName(inClass)]; return description; } @end @implementation OFOpenFileFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
491 492 493 494 495 496 497 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to open file %s with mode %s in class %s! " ERRFMT, | | | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to open file %s with mode %s in class %s! " ERRFMT, [path cString], [mode cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
562 563 564 565 566 567 568 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to read %zu bytes in class %s! " ERRFMT, requestedSize, | | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to read %zu bytes in class %s! " ERRFMT, requestedSize, class_getName(inClass), ERRPARAM]; return description; } @end @implementation OFWriteFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to write %zu bytes in class %s! " ERRFMT, requestedSize, class_getName(inClass), ERRPARAM]; return description; } @end @implementation OFSeekFailedException - initWithClass: (Class)class_ |
︙ | ︙ | |||
598 599 600 601 602 603 604 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Seeking failed in class %s! " ERRFMT, class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { |
︙ | ︙ | |||
656 657 658 659 660 661 662 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to create directory %s in class %s! " ERRFMT, | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to create directory %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
723 724 725 726 727 728 729 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to change mode for file %s to %d in class %s! " ERRFMT, | | | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to change mode for file %s to %d in class %s! " ERRFMT, [path cString], mode, class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
803 804 805 806 807 808 809 | if (description != nil) return description; if (group == nil) description = [[OFString alloc] initWithFormat: @"Failed to change owner for file %s to %s in class %s! " ERRFMT, [path cString], [owner cString], | | | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | if (description != nil) return description; if (group == nil) description = [[OFString alloc] initWithFormat: @"Failed to change owner for file %s to %s in class %s! " ERRFMT, [path cString], [owner cString], class_getName(inClass), ERRPARAM]; else if (owner == nil) description = [[OFString alloc] initWithFormat: @"Failed to change group for file %s to %s in class %s! " ERRFMT, [path cString], [group cString], class_getName(inClass), ERRPARAM]; else description = [[OFString alloc] initWithFormat: @"Failed to change owner for file %s to %s:%s in class %s! " ERRFMT, [path cString], [owner cString], [group cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
892 893 894 895 896 897 898 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to copy file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], | | | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to copy file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
965 966 967 968 969 970 971 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to rename file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], | | | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to rename file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete file %s in class %s! " ERRFMT, [path cString], | | | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete file %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1094 1095 1096 1097 1098 1099 1100 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete directory %s in class %s! " ERRFMT, | | | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete directory %s in class %s! " ERRFMT, [path cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1158 1159 1160 1161 1162 1163 1164 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to link file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], | | | 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to link file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1226 1227 1228 1229 1230 1231 1232 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to symlink file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], | | | 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to symlink file %s to %s in class %s! " ERRFMT, [sourcePath cString], [destinationPath cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1255 1256 1257 1258 1259 1260 1261 | @implementation OFSetOptionFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | @implementation OFSetOptionFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Setting an option in class %s failed!", class_getName(inClass)]; return description; } @end @implementation OFNotConnectedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The socket of type %s is not connected or bound!", class_getName(inClass)]; return description; } @end @implementation OFAlreadyConnectedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The socket of type %s is already connected or bound and thus " @"can't be connected or bound again!", class_getName(inClass)]; return description; } @end @implementation OFAddressTranslationFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 | description = [[OFString alloc] initWithFormat: @"The service %s on %s could not be translated to an " @"address in class %s. This means that either the node was " @"not found, there is no such service on the node, there " @"was a problem with the name server, there was a problem " @"with your network connection or you specified an invalid " @"node or service. " ERRFMT, [service cString], | | | | 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | description = [[OFString alloc] initWithFormat: @"The service %s on %s could not be translated to an " @"address in class %s. This means that either the node was " @"not found, there is no such service on the node, there " @"was a problem with the name server, there was a problem " @"with your network connection or you specified an invalid " @"node or service. " ERRFMT, [service cString], [node cString], class_getName(inClass), AT_ERRPARAM]; else description = [[OFString alloc] initWithFormat: @"An address translation failed in class %s! " ERRFMT, class_getName(inClass), AT_ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A connection to service %s on node %s could not be established " @"in class %s! " ERRFMT, [service cString], [node cString], | | | 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A connection to service %s on node %s could not be established " @"in class %s! " ERRFMT, [service cString], [node cString], class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Binding service %s on node %s using family %d failed in class " @"%s! " ERRFMT, [service cString], [node cString], family, | | | 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 | { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Binding service %s on node %s using family %d failed in class " @"%s! " ERRFMT, [service cString], [node cString], family, class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to listen in socket of type %s with a back log of %d! " | | | 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to listen in socket of type %s with a back log of %d! " ERRFMT, class_getName(inClass), backLog, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1594 1595 1596 1597 1598 1599 1600 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to accept connection in socket of type %s! " ERRFMT, | | | | | | | > | | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to accept connection in socket of type %s! " ERRFMT, class_getName(inClass), ERRPARAM]; return description; } - (int)errNo { return errNo; } @end @implementation OFThreadStartFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Starting a thread of class %s failed!", class_getName(inClass)]; return description; } @end @implementation OFThreadJoinFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Joining a thread of class %s failed! Most likely, another thread " @"already waits for the thread to join.", class_getName(inClass)]; return description; } @end @implementation OFThreadStillRunningException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Deallocation of a thread of type %s was tried, even though it " @"was still running", class_getName(inClass)]; return description; } @end @implementation OFMutexLockFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A mutex could not be locked in class %s", class_getName(inClass)]; return description; } @end @implementation OFMutexUnlockFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A mutex could not be unlocked in class %s", class_getName(inClass)]; return description; } @end @implementation OFHashAlreadyCalculatedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The hash has already been calculated in class %s and thus no new " @"data can be added", class_getName(inClass)]; return description; } @end @implementation OFUnboundNamespaceException + newWithClass: (Class)class_ |
︙ | ︙ | |||
1755 1756 1757 1758 1759 1760 1761 | { if (description != nil) return description; if (ns != nil) description = [[OFString alloc] initWithFormat: @"The namespace %s is not bound in class %s", | | | | 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | { if (description != nil) return description; if (ns != nil) description = [[OFString alloc] initWithFormat: @"The namespace %s is not bound in class %s", class_getName(inClass)]; else if (prefix != nil) description = [[OFString alloc] initWithFormat: @"The prefix %s is not bound to any namespace in %s", class_getName(inClass)]; return description; } - (OFString*)namespace { return ns; |
︙ | ︙ |