@@ -105,7 +105,7 @@ func newVideoDownloadCmd(ctx *cmdContext) *cobra.Command {
105105 })
106106 if err != nil {
107107 return & clierrors.CLIError {
108- Code : "internal_error " ,
108+ Code : "cli_response_encode_error " ,
109109 Message : fmt .Sprintf ("failed to encode response: %v" , err ),
110110 Hint : "Please report this CLI bug with the command you ran." ,
111111 ExitCode : clierrors .ExitGeneral ,
@@ -128,7 +128,7 @@ func extractAssetURL(raw json.RawMessage, videoID string, info assetInfo) (strin
128128 }
129129 if err := json .Unmarshal (raw , & resp ); err != nil {
130130 return "" , & clierrors.CLIError {
131- Code : "response_parse_error " ,
131+ Code : "cli_response_parse_error " ,
132132 Message : "failed to parse the video response" ,
133133 Hint : "The API response could not be parsed. Retry; if it persists, report it (possible CLI/API mismatch)." ,
134134 ExitCode : clierrors .ExitGeneral ,
@@ -191,7 +191,7 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
191191 req , err := http .NewRequestWithContext (ctx , http .MethodGet , videoURL , nil )
192192 if err != nil {
193193 return & clierrors.CLIError {
194- Code : "response_parse_error " ,
194+ Code : "cli_response_parse_error " ,
195195 Message : fmt .Sprintf ("the download URL returned by the API is unusable: %v" , err ),
196196 Hint : "Re-fetch a fresh URL: heygen video get <video_id>" ,
197197 ExitCode : clierrors .ExitGeneral ,
@@ -214,14 +214,14 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
214214 // re-fetch); any other status is the asset host (our storage/CDN) failing.
215215 if resp .StatusCode == http .StatusForbidden || resp .StatusCode == http .StatusNotFound {
216216 return & clierrors.CLIError {
217- Code : "download_url_expired " ,
217+ Code : "cli_download_url_expired " ,
218218 Message : fmt .Sprintf ("download link expired or unavailable (HTTP %d)" , resp .StatusCode ),
219219 Hint : "This download link has expired. Re-fetch a fresh URL: heygen video get <video_id>" ,
220220 ExitCode : clierrors .ExitGeneral ,
221221 }
222222 }
223223 return & clierrors.CLIError {
224- Code : "asset_download_failed " ,
224+ Code : "cli_download_failed " ,
225225 Message : fmt .Sprintf ("download failed with HTTP %d" , resp .StatusCode ),
226226 Hint : "The asset host returned an error fetching the file. This is usually transient — retry shortly." ,
227227 ExitCode : clierrors .ExitGeneral ,
@@ -234,7 +234,7 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
234234 tmp , err := os .CreateTemp (dir , ".heygen-download-*.tmp" )
235235 if err != nil {
236236 return & clierrors.CLIError {
237- Code : "file_io_error " ,
237+ Code : "cli_file_io_error " ,
238238 Message : fmt .Sprintf ("failed to create temp file in %q: %v" , dir , err ),
239239 Hint : "Could not write locally. Check the destination path and free disk space." ,
240240 ExitCode : clierrors .ExitGeneral ,
@@ -247,7 +247,7 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
247247 if copyErr != nil {
248248 _ = os .Remove (tmpPath )
249249 return & clierrors.CLIError {
250- Code : "download_interrupted " ,
250+ Code : "cli_download_interrupted " ,
251251 Message : fmt .Sprintf ("download interrupted: %v" , copyErr ),
252252 Hint : "The transfer was cut off. Retry; the partial file was cleaned up." ,
253253 ExitCode : clierrors .ExitGeneral ,
@@ -256,7 +256,7 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
256256 if closeErr != nil {
257257 _ = os .Remove (tmpPath )
258258 return & clierrors.CLIError {
259- Code : "file_io_error " ,
259+ Code : "cli_file_io_error " ,
260260 Message : fmt .Sprintf ("failed to finalize download: %v" , closeErr ),
261261 Hint : "Could not finalize the file locally. Check free disk space." ,
262262 ExitCode : clierrors .ExitGeneral ,
@@ -269,7 +269,7 @@ func downloadFile(ctx context.Context, videoURL, dest string) error {
269269 if err := os .Rename (tmpPath , dest ); err != nil {
270270 _ = os .Remove (tmpPath )
271271 return & clierrors.CLIError {
272- Code : "file_io_error " ,
272+ Code : "cli_file_io_error " ,
273273 Message : fmt .Sprintf ("failed to move download to %q: %v" , dest , err ),
274274 Hint : "Could not write to the destination path. Check permissions and free disk space." ,
275275 ExitCode : clierrors .ExitGeneral ,
0 commit comments