Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Remove spam exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Nov 3, 2022
1 parent c8b3e89 commit 842fd22
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import fr.jais.scraper.countries.FranceCountry
import fr.jais.scraper.countries.ICountry
import fr.jais.scraper.entities.Episode
import fr.jais.scraper.exceptions.CountryNotSupportedException
import fr.jais.scraper.exceptions.EpisodeException
import fr.jais.scraper.utils.Const
import fr.jais.scraper.utils.Logger
import fr.jais.scraper.utils.toDate
Expand Down Expand Up @@ -46,7 +47,10 @@ class AnimationDigitalNetworkPlatform(scraper: Scraper) :
try {
converter.convertEpisode(country, it, cachedEpisodes)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
if (e !is EpisodeException) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
}

null
}
} ?: emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import fr.jais.scraper.countries.FranceCountry
import fr.jais.scraper.countries.ICountry
import fr.jais.scraper.entities.News
import fr.jais.scraper.exceptions.CountryNotSupportedException
import fr.jais.scraper.exceptions.NewsException
import fr.jais.scraper.utils.CalendarConverter
import fr.jais.scraper.utils.Const
import fr.jais.scraper.utils.Logger
Expand Down Expand Up @@ -66,7 +67,10 @@ class AnimeNewsNetworkPlatform(scraper: Scraper) : IPlatform(
try {
converter.convertNews(country, it, cachedNews)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting news", e)
if (e !is NewsException) {
Logger.log(Level.SEVERE, "Error while converting news", e)
}

null
}
} ?: emptyList()
Expand Down
12 changes: 10 additions & 2 deletions src/main/kotlin/fr/jais/scraper/platforms/CrunchyrollPlatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import fr.jais.scraper.countries.ICountry
import fr.jais.scraper.entities.Episode
import fr.jais.scraper.entities.News
import fr.jais.scraper.exceptions.CountryNotSupportedException
import fr.jais.scraper.exceptions.EpisodeException
import fr.jais.scraper.exceptions.NewsException
import fr.jais.scraper.utils.Browser
import fr.jais.scraper.utils.Const
import fr.jais.scraper.utils.Logger
Expand Down Expand Up @@ -122,7 +124,10 @@ class CrunchyrollPlatform(scraper: Scraper) : IPlatform(
try {
converter.convertEpisode(country, it.asJsonObject, cachedEpisodes)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
if (e !is EpisodeException) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
}

null
}
} ?: emptyList()
Expand All @@ -137,7 +142,10 @@ class CrunchyrollPlatform(scraper: Scraper) : IPlatform(
try {
converter.convertNews(country, it.asJsonObject, cachedNews)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting news", e)
if (e !is NewsException) {
Logger.log(Level.SEVERE, "Error while converting news", e)
}

null
}
} ?: emptyList()
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/fr/jais/scraper/platforms/NetflixPlatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import fr.jais.scraper.countries.FranceCountry
import fr.jais.scraper.countries.ICountry
import fr.jais.scraper.entities.Episode
import fr.jais.scraper.exceptions.CountryNotSupportedException
import fr.jais.scraper.exceptions.EpisodeException
import fr.jais.scraper.utils.*
import org.jsoup.nodes.Document
import java.util.*
Expand Down Expand Up @@ -172,7 +173,10 @@ class NetflixPlatform(scraper: Scraper) : IPlatform(
try {
converter.convertEpisode(country, calendar, content, it, cachedEpisodes)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
if (e !is EpisodeException) {
Logger.log(Level.SEVERE, "Error while converting episode", e)
}

null
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/fr/jais/scraper/platforms/WakanimPlatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import fr.jais.scraper.entities.Anime
import fr.jais.scraper.entities.Episode
import fr.jais.scraper.exceptions.CatalogueNotFoundException
import fr.jais.scraper.exceptions.CountryNotSupportedException
import fr.jais.scraper.exceptions.EpisodeException
import fr.jais.scraper.exceptions.animes.AnimeImageNotFoundException
import fr.jais.scraper.exceptions.animes.AnimeNameNotFoundException
import fr.jais.scraper.exceptions.episodes.EpisodeNumberNotFoundException
Expand Down Expand Up @@ -139,7 +140,10 @@ class WakanimPlatform(scraper: Scraper) : IPlatform(
try {
converter.convertEpisode(calendar, it, cachedEpisodes)
} catch (e: Exception) {
Logger.log(Level.SEVERE, "Error while converting episode ${it.tmpUrl}", e)
if (e !is EpisodeException) {
Logger.log(Level.SEVERE, "Error while converting episode ${it.tmpUrl}", e)
}

null
}
}
Expand Down

0 comments on commit 842fd22

Please sign in to comment.