25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/project_types/script/ui/error_handler.rb', line 25
def self.error_messages(e)
case e
when Errno::EACCES
{
cause_of_error: ShopifyCli::Context.message('script.error.eacces_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.eacces_help'),
}
when Errno::ENOSPC
{
cause_of_error: ShopifyCli::Context.message('script.error.enospc_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.enospc_help'),
}
when ShopifyCli::OAuth::Error
{
cause_of_error: ShopifyCli::Context.message('script.error.oauth_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.oauth_help'),
}
when Errors::InvalidContextError
{
cause_of_error: ShopifyCli::Context.message('script.error.invalid_context_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.invalid_context_help'),
}
when Errors::InvalidConfigYAMLError
{
cause_of_error: ShopifyCli::Context.message('script.error.invalid_config', e.config_file),
}
when Errors::InvalidScriptNameError
{
cause_of_error: ShopifyCli::Context.message('script.error.invalid_script_name_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.invalid_script_name_help'),
}
when Errors::NoExistingAppsError
{
cause_of_error: ShopifyCli::Context.message('script.error.no_existing_apps_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.no_existing_apps_help'),
}
when Errors::NoExistingOrganizationsError
{
cause_of_error: ShopifyCli::Context.message('script.error.no_existing_orgs_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.no_existing_orgs_help'),
}
when Errors::NoExistingStoresError
{
cause_of_error: ShopifyCli::Context.message('script.error.no_existing_stores_cause'),
help_suggestion: ShopifyCli::Context.message(
'script.error.no_existing_stores_help',
organization_id: e.organization_id
),
}
when Errors::ScriptProjectAlreadyExistsError
{
cause_of_error: ShopifyCli::Context.message('script.error.project_exists_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.project_exists_help'),
}
when Layers::Domain::Errors::InvalidExtensionPointError
{
cause_of_error: ShopifyCli::Context.message('script.error.invalid_extension_cause', e.type),
help_suggestion: ShopifyCli::Context.message(
'script.error.invalid_extension_help',
Script::Layers::Application::ExtensionPoints.types.join(', ')
),
}
when Layers::Domain::Errors::ScriptNotFoundError
{
cause_of_error: ShopifyCli::Context.message(
'script.error.script_not_found_cause',
e.script_name,
e.extension_point_type
),
}
when Layers::Infrastructure::Errors::AppNotInstalledError
{
cause_of_error: ShopifyCli::Context.message('script.error.app_not_installed_cause'),
}
when Layers::Infrastructure::Errors::AppScriptNotPushedError,
Layers::Infrastructure::Errors::AppScriptUndefinedError
{
cause_of_error: ShopifyCli::Context.message('script.error.app_script_not_pushed_help'),
}
when Layers::Infrastructure::Errors::BuildError
{
cause_of_error: ShopifyCli::Context.message('script.error.build_error_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.build_error_help'),
}
when Layers::Infrastructure::Errors::DependencyInstallError
{
cause_of_error: ShopifyCli::Context.message('script.error.dependency_install_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.dependency_install_help'),
}
when Layers::Infrastructure::Errors::ForbiddenError
{
cause_of_error: ShopifyCli::Context.message('script.error.forbidden_error_cause'),
}
when Layers::Infrastructure::Errors::GraphqlError
{
cause_of_error: ShopifyCli::Context.message('script.error.graphql_error_cause', e.errors.join(', ')),
help_suggestion: ShopifyCli::Context.message('script.error.graphql_error_help'),
}
when Layers::Infrastructure::Errors::ScriptRepushError
{
cause_of_error: ShopifyCli::Context.message('script.error.script_repush_cause', e.api_key),
help_suggestion: ShopifyCli::Context.message('script.error.script_repush_help'),
}
when Layers::Infrastructure::Errors::ShopAuthenticationError
{
cause_of_error: ShopifyCli::Context.message('script.error.shop_auth_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.shop_auth_help'),
}
when Layers::Infrastructure::Errors::ShopScriptConflictError
{
cause_of_error: ShopifyCli::Context.message('script.error.shop_script_conflict_cause'),
help_suggestion: ShopifyCli::Context.message('script.error.shop_script_conflict_help'),
}
when Layers::Infrastructure::Errors::ShopScriptUndefinedError
{
cause_of_error: ShopifyCli::Context.message('script.error.shop_script_undefined_cause'),
}
when Layers::Infrastructure::Errors::PackagesOutdatedError
{
cause_of_error: ShopifyCli::Context.message(
'script.error.packages_outdated_cause',
e.outdated_packages.join(', ')
),
help_suggestion: ShopifyCli::Context.message(
'script.error.packages_outdated_help',
e.outdated_packages.collect { |package| "#{package}@latest" }.join(' ')
),
}
end
end
|