Overview
Comment: | Don't use OFMutableStrings in OFExceptions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8d61f0f51df4c0ec7aca403ec0e9065d |
User & Date: | js on 2009-06-29 17:42:28 |
Other Links: | manifest | tags |
Context
2009-06-30
| ||
12:07 | A few renames in OFObject, see details. check-in: 67bb344ba6 user: js tags: trunk | |
2009-06-29
| ||
17:42 | Don't use OFMutableStrings in OFExceptions. check-in: 8d61f0f51d user: js tags: trunk | |
12:33 | Changes to OFDictionary, OFIterator and OFList - see details. check-in: 24ecf55297 user: js tags: trunk | |
Changes
Modified src/OFExceptions.m from [b2319a10bf] to [fb0a17fe11].
︙ | ︙ | |||
49 50 51 52 53 54 55 | #define GET_AT_ERR WSAGetLastError() #define GET_SOCK_ERR WSAGetLastError() #define ERRFMT "Error code was: %d" #define ERRPARAM err #define AT_ERRPARAM err #endif | < < | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #define GET_AT_ERR WSAGetLastError() #define GET_SOCK_ERR WSAGetLastError() #define ERRFMT "Error code was: %d" #define ERRPARAM err #define AT_ERRPARAM err #endif #import "asprintf.h" @implementation OFAllocFailedException + (Class)class { return self; } |
︙ | ︙ | |||
121 122 123 124 125 126 127 | } - (OFString*)string { if (string != nil) return string; | | | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Could not allocate %zu bytes in class %s!", req_size, [class name]]; return string; } - (size_t)requestedSize { return req_size; |
︙ | ︙ | |||
157 158 159 160 161 162 163 | } - (OFString*)string { if (string != nil) return string; | | | | < | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | } - (OFString*)string { if (string != nil) return string; string = [[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 name]]; return string; } - (void*)pointer { return pointer; |
︙ | ︙ | |||
196 197 198 199 200 201 202 | } - (OFString*)string { if (string != nil) return string; | | | < | | | < | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The method %s of class %s is not or not fully implemented!", SEL_NAME(selector), [class name]]; return string; } @end @implementation OFOutOfRangeException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Value out of range in class %s!", [class name]]; return string; } @end @implementation OFInvalidArgumentException + newWithClass: (Class)class_ |
︙ | ︙ | |||
242 243 244 245 246 247 248 | } - (OFString*)string { if (string != nil) return string; | | | < | | | < | | < | | < | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The argument for method %s of class %s is invalid!", SEL_NAME(selector), [class name]]; return string; } @end @implementation OFInvalidEncodingException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The encoding is invalid for class %s!", [class name]]; return string; } @end @implementation OFInvalidFormatException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The format is invalid for class %s!", [class name]]; return string; } @end @implementation OFInitializationFailedException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Initialization failed for class %s!", [class name]]; return string; } @end @implementation OFOpenFileFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
329 330 331 332 333 334 335 | } - (OFString*)string { if (string != nil) return string; | | | < | < | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Failed to open file %s with mode %s in class %s! " ERRFMT, [path cString], [mode cString], [self name], ERRPARAM]; return string; } - (int)errNo { return err; |
︙ | ︙ | |||
434 435 436 437 438 439 440 | @implementation OFReadFailedException - (OFString*)string { if (string != nil) return string;; if (has_items) | | | < | < | | < | | | < | < | | < | | | < | | < | | | < < | 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 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | @implementation OFReadFailedException - (OFString*)string { if (string != nil) return string;; if (has_items) string = [[OFString alloc] initWithFormat: @"Failed to read %zu items of size %zu in class %s! " ERRFMT, req_items, req_size, [class name], ERRPARAM]; else string = [[OFString alloc] initWithFormat: @"Failed to read %zu bytes in class %s! " ERRFMT, req_size, [class name], ERRPARAM]; return string; } @end @implementation OFWriteFailedException - (OFString*)string { if (string != nil) return string; if (has_items) string = [[OFString alloc] initWithFormat: @"Failed to write %zu items of size %zu in class %s! " ERRFMT, req_items, req_size, [class name], ERRPARAM]; else string = [[OFString alloc] initWithFormat: @"Failed to write %zu bytes in class %s! " ERRFMT, req_size, [class name], ERRPARAM]; return string; } @end @implementation OFSetOptionFailedException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Setting an option in class %s failed!", [class name]]; return string; } @end @implementation OFNotConnectedException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The socket of type %s is not connected or bound!", [class name]]; return string; } @end @implementation OFAlreadyConnectedException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The socket of type %s is already connected or bound and thus " @"can't be connected or bound again!", [class name]]; return string; } @end @implementation OFAddressTranslationFailedException + newWithClass: (Class)class_ |
︙ | ︙ | |||
551 552 553 554 555 556 557 | } - (OFString*)string { if (string != nil) return string; | | | | < | | | < | < | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | } - (OFString*)string { if (string != nil) return string; string = [[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 name], AT_ERRPARAM]; return string; } - (int)errNo { return err; |
︙ | ︙ | |||
617 618 619 620 621 622 623 | } - (OFString*)string { if (string != nil) return string; | | | < | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"A connection to service %s on node %s could not be established " @"in class %s! " ERRFMT, [node cString], [service cString], [class name], ERRPARAM]; return string; } - (int)errNo { return err; |
︙ | ︙ | |||
682 683 684 685 686 687 688 | } - (OFString*)string { if (string != nil) return string; | | | < | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Binding service %s on node %s using family %d failed in class " @"%s! " ERRFMT, [service cString], [node cString], family, [class name], ERRPARAM]; return string; } - (int)errNo { return err; |
︙ | ︙ | |||
736 737 738 739 740 741 742 | } - (OFString*)string { if (string != nil) return string; | | | < | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Failed to listen in socket of type %s with a back log of %d! " ERRFMT, [class name], backlog, ERRPARAM]; return string; } - (int)errNo { return err; |
︙ | ︙ | |||
770 771 772 773 774 775 776 | } - (OFString*)string { if (string != nil) return string; | | | < | | | | < < | | | < | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | } - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Failed to accept connection in socket of type %s! " ERRFMT, [class name], ERRPARAM]; return string; } - (int)errNo { return err; } @end @implementation OFThreadJoinFailedException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"Joining a thread of class %s failed! Most likely, another thread " @"already waits for the thread to join.", [class name]]; return string; } @end @implementation OFThreadCanceledException - (OFString*)string { if (string != nil) return string; string = [[OFString alloc] initWithFormat: @"The requested action cannot be performed because the thread of " @"class %s was canceled!", [class name]]; return string; } @end |