Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

How can i disable error dialog boxes in code? #9

Closed
journeym opened this issue Dec 4, 2019 · 18 comments
Closed

How can i disable error dialog boxes in code? #9

journeym opened this issue Dec 4, 2019 · 18 comments

Comments

@journeym
Copy link

journeym commented Dec 4, 2019

Im uploading large amount of files, and all that hit the quota get popup with upload failed exception.
How to disable that with not much effort involved?

@Stekeblad
Copy link
Owner

I'm sorry. but there is no option to disable popups, the only thing you can do right now is probably not to queue too many uploads at once to reduce the number of popups.

It is a good idea to abort all uploads if the program notices the limit has been reach and only display one warning instead of one per video.

I do not think I ever seen how that error looks like, if you please can share the full error here I should be able to add code to handle it and get rid of the extra popups.

@journeym
Copy link
Author

journeym commented Dec 4, 2019

image

`Failed to upload the video "Ммарло - Компас"
Here is the error details:

403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308",
"reason" : "dailyLimitExceeded",
"extendedHelp" : "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308"
} ],
"message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308"
}

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308",
"reason" : "dailyLimitExceeded",
"extendedHelp" : "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308"
} ],
"message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:150)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:554)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
at io.github.stekeblad.videouploader.youtube.Uploader.upload(Uploader.java:258)
at io.github.stekeblad.videouploader.youtube.Uploader.access$000(Uploader.java:39)
at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:132)
at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:126)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
`

@journeym
Copy link
Author

journeym commented Dec 4, 2019

Yeah i know there is no such option.
Im just unfamiliar with java, and were unable to find where is the popup called.

@Stekeblad
Copy link
Owner

There are several steps to get from the stacktrace to where the popup is created, following them you end up at the bottom of the mainWindowController. Are you familiar with other programming languages and curious on how it got there?

@journeym
Copy link
Author

journeym commented Dec 5, 2019

Thanks!
Now im unable to build the app under windows / latest jdk
when i run gradlew build, it asks for mainClassName
`FAILURE: Build failed with an exception.

  • What went wrong:
    A problem was found with the configuration of task ':startScripts'.

No value has been specified for property 'mainClassName'.`

if i supply some random mainClassName, then it builds, but after that, when i run gradlew run, it says Error: Could not find or load main class SomeClassName

@Stekeblad
Copy link
Owner

By "latest jdk", do you mean the latest version of JDK 8? Other versions of Java is currently not supported.

The name of the main class is "Main" and located in src/main/java/io/github/stekeblad/videouploader/main/Main.java

I am sorry but I do not know much about gradle and can not give more detailed help on your error, I only use gradle for dependencies.

@journeym
Copy link
Author

journeym commented Dec 5, 2019

Using that class name gets the same result.
Then how do you compile this code? Are you using some IDE?
Thats the first java code im trying to compile, so i presume im just doing something wrong.

@Stekeblad
Copy link
Owner

I am using IntelliJ (the Community edition is free)

@journeym
Copy link
Author

journeym commented Dec 5, 2019

All right, ill try it out, thanks.

@journeym
Copy link
Author

journeym commented Dec 5, 2019

All right, just cloning your project, building it in idea and then selecting build artifacts (everything goes smoothly w/o error) gives me a jar file in out\artifacts\videouploader_main_jar directory, but with significantly lesser size than yours (mine about 169kb). And it doesn't run.
seems i dont have the required java dev. experience for quickly fixing that problem.

@Stekeblad
Copy link
Owner

Its easier to run the code from inside IntelliJ, I had to spend hours on my build script to create the fix for version 1.3.1.

Go to Run --> Edit configurations and create an "Application" configuration and create a configuration like the one in the image.
image

I think that is enough. If you have all the gradle files and the code compiles you should be able to select the configuration in the top right and click on run. With a run configuration you will also be able to run the code in debug mode and set breakpoints.

Please note that you will not be able to do anything that involves YouTube when working with the code, it will always fail in or around Auth.authUser(); because it requires a secret key that is not included in git. You need to work around it, for the failure popup you could use the debug code already added in the top of the Uploader.upload() method in some way.

@journeym
Copy link
Author

journeym commented Dec 5, 2019

Now im able to run, and just comment out the popup, great.
But true, upload isnt working, as well as $(rawname) resolution in preset
Upload faiure doesnt mention authuser
Stacktrace looks like this

`Failed to upload the video "ttt"
Here is the error details:

null

java.lang.NullPointerException
at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:135)
at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:126)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
`

@Stekeblad
Copy link
Owner

Looking at your stacktrace and assuming the first lines looks the same for as in the latest commit:
Uploader.java:135 looks like this:
if (! e.getMessage().equals("INTERRUPTED"))
and is inside the catch block of a try-catch. I think its highly unlikely e is null so that would mean that e.getMessage() returns null.

Did you add a line like
throw new Exception();
in the upload method? I just tried and got the same type of error if I throw an exception without a message, throw the exception like this instead:
throw new Exception("My helpful exception message");

@journeym
Copy link
Author

journeym commented Dec 6, 2019

I haven't added or modified anything, i just created run config according to your instruction, and ran the application. I have copied VideoUploader folder to compiled application folder, form the original jar application location (to get my preset). Then, i noticed, that $(rawname) is not resolving, and trying to upload results in the above error.
I also tried to create new preset with static track name, to make sure that $(rawname) resolution doesn't impact upload, and got the same result.

Can you please compile a new version for me with commented out AlertUtils.exceptionDialog (879 in mainWindowController.java)?

Stekeblad added a commit that referenced this issue Dec 16, 2019
…daily

quota limit has been reached and if so aborts all started uploads and
shows a dialog telling that the program can not do anymore uploading
right now.
- Fixed a translation miss where a line was in swedish with english
settings and english with swedish settings.
- Added a couple of more error checks (try-catch blocks) and removed one
error check (if statement) that IntelliJ claimed to be redundant.
@Stekeblad
Copy link
Owner

Hi journeym and sorry for the waiting.

I have just uploaded version 1.3.2 that should only show one exception dialog if the quota limit is reached. I have however not been able to test it on the real exception, only by trying to fake it.

@journeym
Copy link
Author

journeym commented Mar 3, 2020

Actually, this even got worse.
Now it shows 2 errors for every failed upload ;)
image
image

@journeym
Copy link
Author

journeym commented Mar 3, 2020

Can you please write a bit about how to compile that under any distro. Release version, pref.

@Stekeblad
Copy link
Owner

The left error for the quota is easily fixed, but I can not see the entire error message for the right error. If you see it again, please update with the entire error message.

I am happy to accept pull requests and include them in future releases, but I can not help you with creating a release on your computer as the process includes secrets between me and YouTube that make YouTube recognise the program as Stekeblads Video Uploader and not any other program that connects to the API.

Stekeblad added a commit that referenced this issue Mar 7, 2020
…led for this app.

Issue #9 about error dialogs: attempt of fixing a ConcurrentModificationException
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants