Overview
Comment: | Clean up exception descriptions a little. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
29e981d99af223b793d698152b82b2a3 |
User & Date: | js on 2011-02-26 14:23:45 |
Other Links: | manifest | tags |
Context
2011-02-26
| ||
14:27 | of_std{in,out,err} don't support seeking. check-in: 9160269d5f user: js tags: trunk | |
14:23 | Clean up exception descriptions a little. check-in: 29e981d99a user: js tags: trunk | |
2011-02-25
| ||
16:05 | OFHTTPRequest: Send a proper request in case path is nil. check-in: 7b6a706687 user: js tags: trunk | |
Changes
Modified src/OFExceptions.m from [52c201d27f] to [744b7f16c3].
︙ | ︙ | |||
24 25 26 27 28 29 30 | #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) | < | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #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" #import "OFHTTPRequest.h" #import "OFAutoreleasePool.h" |
︙ | ︙ | |||
218 219 220 221 222 223 224 | - (OFString*)description { if (description != nil) return description; if (requestedSize) description = [[OFString alloc] initWithFormat: | | | | < | < | 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 250 251 252 253 | - (OFString*)description { if (description != nil) return description; if (requestedSize) description = [[OFString alloc] initWithFormat: @"Could not allocate %zu bytes in class %@!", requestedSize, inClass]; else description = [[OFString alloc] initWithFormat: @"Could not allocate enough memory in class %@!", 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 %@ was mutated during enumeration!", inClass]; return description; } @end @implementation OFMemoryNotPartOfObjectException + newWithClass: (Class)class_ |
︙ | ︙ | |||
280 281 282 283 284 285 286 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Memory at %p was not allocated as part of object of class %@, " @"thus the memory allocation was not changed! It is also possible " @"that there was an attempt to free the same memory twice.", pointer, inClass]; return description; } - (void*)pointer { return pointer; |
︙ | ︙ | |||
326 327 328 329 330 331 332 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | | 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 353 354 355 356 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The method %s of class %@ is not or not fully implemented!", sel_getName(selector), 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 %@!", inClass]; return description; } @end @implementation OFInvalidArgumentException + newWithClass: (Class)class_ |
︙ | ︙ | |||
383 384 385 386 387 388 389 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | | | < | | 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 450 451 452 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The argument for method %s of class %@ is invalid!", sel_getName(selector), 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 %@!", inClass]; return description; } @end @implementation OFInvalidFormatException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The format is invalid for class %@!", inClass]; return description; } @end @implementation OFMalformedXMLException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The parser in class %@ encountered malformed XML!", inClass]; return description; } @end @implementation OFInitializationFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Initialization failed for or in class %@!", inClass]; return description; } @end @implementation OFOpenFileFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
498 499 500 501 502 503 504 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to open file %@ with mode %@ in class %@! " ERRFMT, path, mode, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
569 570 571 572 573 574 575 | @implementation OFReadFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | | | 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 592 593 594 | @implementation OFReadFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to read %zu bytes in class %@! " ERRFMT, requestedSize, 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 %@! " ERRFMT, requestedSize, inClass, ERRPARAM]; return description; } @end @implementation OFSeekFailedException - initWithClass: (Class)class_ |
︙ | ︙ | |||
606 607 608 609 610 611 612 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | < | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Seeking failed in class %@! " ERRFMT, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
663 664 665 666 667 668 669 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to create directory %@ in class %@! " ERRFMT, path, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
725 726 727 728 729 730 731 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to change to directory %@ in class %@! " ERRFMT, path, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
792 793 794 795 796 797 798 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to change mode for file %@ to %d in class %@! " ERRFMT, path, mode, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
871 872 873 874 875 876 877 | - (OFString*)description { if (description != nil) return description; if (group == nil) description = [[OFString alloc] initWithFormat: | | | | | | | < | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | - (OFString*)description { if (description != nil) return description; if (group == nil) description = [[OFString alloc] initWithFormat: @"Failed to change owner for file %@ to %@ in class %@! " ERRFMT, path, owner, inClass, ERRPARAM]; else if (owner == nil) description = [[OFString alloc] initWithFormat: @"Failed to change group for file %@ to %@ in class %@! " ERRFMT, path, group, inClass, ERRPARAM]; else description = [[OFString alloc] initWithFormat: @"Failed to change owner for file %@ to %@:%@ in class %@! " ERRFMT, path, owner, group, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
958 959 960 961 962 963 964 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to copy file %@ to %@ in class %@! " ERRFMT, sourcePath, destinationPath, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to rename file %@ to %@ in class %@! " ERRFMT, sourcePath, destinationPath, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1097 1098 1099 1100 1101 1102 1103 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete file %@ in class %@! " ERRFMT, path, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete directory %@ in class %@! " ERRFMT, path, | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to delete directory %@ in class %@! " ERRFMT, path, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1222 1223 1224 1225 1226 1227 1228 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to link file %@ to %@ in class %@! " ERRFMT, sourcePath, destinationPath, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1289 1290 1291 1292 1293 1294 1295 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to symlink file %@ to %@ in class %@! " ERRFMT, sourcePath, destinationPath, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1319 1320 1321 1322 1323 1324 1325 | @implementation OFSetOptionFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | < | | | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | @implementation OFSetOptionFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Setting an option in class %@ failed!", inClass]; return description; } @end @implementation OFNotConnectedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The socket of type %@ is not connected or bound!", inClass]; return description; } @end @implementation OFAlreadyConnectedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The socket of type %@ is already connected or bound and thus " @"can't be connected or bound again!", inClass]; return description; } @end @implementation OFAddressTranslationFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 | { if (description != nil) return description; if (host != nil) description = [[OFString alloc] initWithFormat: @"The host %@ could not be translated to an address in " | | | < | | | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | { if (description != nil) return description; if (host != nil) description = [[OFString alloc] initWithFormat: @"The host %@ could not be translated to an address in " @"class %@. This means that either the host was not found, " @"there was a problem with the name server, there was a " @"problem with your network connection or you specified an " @"invalid host. " ERRFMT, host, inClass, AT_ERRPARAM]; else description = [[OFString alloc] initWithFormat: @"An address translation failed in class %@! " ERRFMT, inClass, AT_ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A connection to %@ on port %" @PRIu16 @"could not be established " | | < | 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"A connection to %@ on port %" @PRIu16 @"could not be established " @"in class %@! " ERRFMT, host, port, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1546 1547 1548 1549 1550 1551 1552 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Binding to port %" @PRIu16 @" on host %@ failed in class %@! " ERRFMT, port, host, inClass, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1601 1602 1603 1604 1605 1606 1607 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to listen in socket of type %@ with a back log of %d! " ERRFMT, inClass, backLog, ERRPARAM]; return description; } - (int)errNo { return errNo; |
︙ | ︙ | |||
1634 1635 1636 1637 1638 1639 1640 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | | | | | | | < | | | 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 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Failed to accept connection in socket of type %@! " ERRFMT, 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 %@ failed!", inClass]; return description; } @end @implementation OFThreadJoinFailedException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Joining a thread of class %@ failed! Most likely, another thread " @"already waits for the thread to join.", inClass]; return description; } @end @implementation OFThreadStillRunningException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Deallocation of a thread of type %@ was tried, even though it " @"was still running", 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 %@", 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 %@", 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 %@ and thus no new " @"data can be added", inClass]; return description; } @end @implementation OFUnboundNamespaceException + newWithClass: (Class)class_ |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | - (OFString*)description { if (description != nil) return description; if (ns != nil) description = [[OFString alloc] initWithFormat: | | < | | | 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | - (OFString*)description { if (description != nil) return description; if (ns != nil) description = [[OFString alloc] initWithFormat: @"The namespace %@ is not bound in class %@", ns, inClass]; else if (prefix != nil) description = [[OFString alloc] initWithFormat: @"The prefix %@ is not bound to any namespace in class %@", prefix, inClass]; return description; } - (OFString*)namespace { return ns; |
︙ | ︙ | |||
1861 1862 1863 1864 1865 1866 1867 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | < | 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 | - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"The protocol of URL %@ is not supported by class %@", URL, inClass]; return description; } - (OFURL*)URL { return URL; } @end @implementation OFInvalidServerReplyException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Got an invalid reply from the server in class %@", inClass]; return description; } @end @implementation OFHTTPRequestFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
1952 1953 1954 1955 1956 1957 1958 | type = "POST"; break; } pool = [[OFAutoreleasePool alloc] init]; description = [[OFString alloc] initWithFormat: | | | | 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | type = "POST"; break; } pool = [[OFAutoreleasePool alloc] init]; description = [[OFString alloc] initWithFormat: @"A HTTP %s request in class %@ with URL %@ failed with code %d", type, inClass, [HTTPRequest URL], statusCode]; [pool release]; return description; } - (OFHTTPRequest*)HTTPRequest |
︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 | @implementation OFTruncatedDataException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: | | | | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | @implementation OFTruncatedDataException - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Truncated data was received or produced in class %@ while it " @"should not have been truncated!", inClass]; return description; } @end |