Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using print statement instead of error for failed downloads #201

Closed
h1hi76 opened this issue Feb 20, 2025 · 5 comments
Closed

Using print statement instead of error for failed downloads #201

h1hi76 opened this issue Feb 20, 2025 · 5 comments
Assignees

Comments

@h1hi76
Copy link

h1hi76 commented Feb 20, 2025

Hey there again,

I'm working on scripting some automation using this tool but since you're not pushing an error I can't validate if an apk was downloaded or not directly from the tools response.

Can you swap out the print statements for "Invalid app response for om.instagram.android. Skipping..." for an error?

Not sure if the "Downloading com.instagram.android..." will be an issue either. It's redundant since you show it's downloading if there is a valid package name.

Image

@Hainish
Copy link
Member

Hainish commented Feb 20, 2025

It's useful to see "Downloading com.instagram.android..." and "com.instagram.android downloaded successfully!" since the indicatif::MultiProgress bar disappears when the download completes. It is also useful in the context of downloading multiple apps to see when a specific one starts and completes downloading.

I think it makes sense to replace the println! macros with eprintln! macros when an error is produced, as exemplified in https://doc.rust-lang.org/book/ch12-06-writing-to-stderr-instead-of-stdout.html#printing-errors-to-standard-error. I'll work on this.

@Hainish Hainish self-assigned this Feb 20, 2025
@h1hi76
Copy link
Author

h1hi76 commented Feb 21, 2025

Ah, you're totally correct.

You got it, thanks a million!

@Hainish
Copy link
Member

Hainish commented Feb 21, 2025

I just pushed a change ensuring error messages appear in stderr: 19c24b8. The MultiProgress.println statements already result in stderr output, but I've had to change a few println!s to eprintln! or MultiProgress.println.

For json output when listing versions of an app when output_format=json is specified I've kept it to stdout because I'm of the opinion that the error should be parsed as part of a json object which is output on the same channel as a successful json result would be.

@Hainish
Copy link
Member

Hainish commented Feb 21, 2025

@h1hi76 is this resolved for you?

@Hainish
Copy link
Member

Hainish commented Feb 22, 2025

2f4a159 also ensures the "Downloading {}..." and "{} downloaded successfully!" messages go to stdout instead of stderror, which I think is proper.

Closing, lmk if there are outstanding issues here and I'll re-open.

@Hainish Hainish closed this as completed Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants