Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: Source/bindings/v8/ExceptionMessages.cpp

Issue 38063003: Improve TypeError messages from failed array conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve TypeError messages from failed array conversions. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 String ExceptionMessages::failedToSet(const String& property, const String& type , const String& detail) 51 String ExceptionMessages::failedToSet(const String& property, const String& type , const String& detail)
52 { 52 {
53 return "Failed to set the '" + property + "' property on '" + type + "': " + detail; 53 return "Failed to set the '" + property + "' property on '" + type + "': " + detail;
54 } 54 }
55 55
56 String ExceptionMessages::failedToDelete(const String& property, const String& t ype, const String& detail) 56 String ExceptionMessages::failedToDelete(const String& property, const String& t ype, const String& detail)
57 { 57 {
58 return "Failed to delete the '" + property + "' property from '" + type + "' : " + detail; 58 return "Failed to delete the '" + property + "' property from '" + type + "' : " + detail;
59 } 59 }
60 60
61 String ExceptionMessages::notASequenceType(const String& argument) 61 String ExceptionMessages::notASequenceTypeArgumentOrValue(int argumentIndexOrVal ue)
62 { 62 {
63 return argument + " argument is neither an array, nor does it have indexed p roperties."; 63 String kind(" argument");
64
65 String prefix;
66 switch (argumentIndexOrValue) {
67 case 1:
68 prefix = "First";
69 break;
70 case 2:
71 prefix = "Second";
72 break;
73 case 3:
74 prefix = "Third";
75 break;
76 default:
77 if (argumentIndexOrValue <= 0)
78 kind = "The value provided";
79 else
80 prefix = String::number(argumentIndexOrValue) + "th";
81 break;
82 }
83 return prefix + kind + " is neither an array, nor does it have indexed prope rties.";
84 }
85
86 String ExceptionMessages::notASequenceTypeProperty(const String& propertyName)
87 {
88 return "'" + propertyName + "' property is neither an array, nor does it hav e indexed properties.";
64 } 89 }
65 90
66 String ExceptionMessages::notEnoughArguments(unsigned expected, unsigned provide d) 91 String ExceptionMessages::notEnoughArguments(unsigned expected, unsigned provide d)
67 { 92 {
68 return String::number(expected) + " argument" + (expected > 1 ? "s" : "") + " required, but only " + String::number(provided) + " present."; 93 return String::number(expected) + " argument" + (expected > 1 ? "s" : "") + " required, but only " + String::number(provided) + " present.";
69 } 94 }
70 95
71 } // namespace WebCore 96 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698