File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ fn main() {
4141 }
4242
4343 let problem = problem:: get_problem ( id)
44- . expect ( & format ! ( "problem #{} not found" , id) ) ;
44+ . expect ( & format ! ( "Error: failed to get problem #{} \
45+ (The problem may be paid-only or may not be exist).",
46+ id) ) ;
4547 let code = problem. code_definition . iter ( )
4648 . filter ( |& d| { d. value == "rust" } )
4749 . next ( ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ pub fn get_problem(id: u32) -> Option<Problem> {
2121 let problems = get_problems ( ) . unwrap ( ) ;
2222 for problem in problems. stat_status_pairs . iter ( ) {
2323 if problem. stat . question_id == id {
24+
25+ if problem. paid_only {
26+ return None
27+ }
28+
2429 let client = reqwest:: Client :: new ( ) ;
2530 let resp: RawProblem = client. post ( GRAPHQL_URL )
2631 . json ( & Query :: question_query ( problem. stat . question_title_slug . as_ref ( ) . unwrap ( ) ) )
You can’t perform that action at this time.
0 commit comments