1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h"
7 #include "base/logging.h"
8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util_mac.h"
11 void AppleScript::SetError(AppleScript::ErrorCode errorCode) {
12 using l10n_util::GetNSString;
13 NSScriptCommand* current_command = [NSScriptCommand currentCommand];
14 [current_command setScriptErrorNumber:(int)errorCode];
15 NSString* error_string = @"";
18 error_string = GetNSString(IDS_GET_PROFILE_ERROR_APPLESCRIPT_MAC);
20 case errBookmarkModelLoad:
21 error_string = GetNSString(IDS_BOOKMARK_MODEL_LOAD_ERROR_APPLESCRIPT_MAC);
23 case errCreateBookmarkFolder:
25 GetNSString(IDS_CREATE_BOOKMARK_FOLDER_ERROR_APPLESCRIPT_MAC);
27 case errCreateBookmarkItem:
29 GetNSString(IDS_CREATE_BOOKMARK_ITEM_ERROR_APPLESCRIPT_MAC);
32 error_string = GetNSString(IDS_INVALID_URL_APPLESCRIPT_MAC);
34 case errInitiatePrinting:
35 error_string = GetNSString(IDS_INITIATE_PRINTING_ERROR_APPLESCRIPT_MAC);
37 case errInvalidSaveType:
38 error_string = GetNSString(IDS_INVALID_SAVE_TYPE_ERROR_APPLESCRIPT_MAC);
41 error_string = GetNSString(IDS_INVALID_MODE_ERROR_APPLESCRIPT_MAC);
43 case errInvalidTabIndex:
44 error_string = GetNSString(IDS_INVALID_TAB_INDEX_APPLESCRIPT_MAC);
47 error_string = GetNSString(IDS_SET_MODE_APPLESCRIPT_MAC);
50 error_string = GetNSString(IDS_WRONG_INDEX_ERROR_APPLESCRIPT_MAC);
55 [current_command setScriptErrorString:error_string];