You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "big-r81 (via GitHub)" <gi...@apache.org> on 2026/09/30 19:21:36 UTC

[I] Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead [couchdb]

big-r81 opened a new issue, #6144:
URL: https://github.com/apache/couchdb/issues/6144

   Since OTP29, there will be a warning when using the catch operator, which has been deprecated for a long time. It is recommended to instead use try…catch.
   
   Here is a list of locations, where only a `catch ...` is used (commit 75a77a75081442ab5c0798fbf9f9d8083abad099):
   
   ```
   src/proper/src/proper_statem.erl:770:46: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_epi/src/couch_epi_module_keeper.erl:59:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_epi/src/couch_epi_functions_gen.erl:343:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_epi/src/couch_epi_functions_gen.erl:352:6: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_log/src/couch_log_trunc_io.erl:99:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_log/src/couch_log_trunc_io_fmt.erl:291:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/chttpd/src/chttpd.erl:228:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/chttpd/src/chttpd_misc.erl:198:18: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/chttpd/src/chttpd_rewrite.erl:362:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/chttpd/src/chttpd_db.erl:633:22: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/chttpd/src/chttpd_db.erl:1319:30: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd.erl:186:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch.erl:35:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_auth.erl:374:35: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/test_util.erl:163:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/test_util.erl:164:20: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/test_util.erl:272:6: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/test_util.erl:273:12: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_util.erl:117:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_util.erl:153:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_util.erl:154:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_util.erl:547:17: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_rewrite.erl:358:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db.erl:960:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db_split.erl:203:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db_split.erl:204:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_users_db.erl:48:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_users_db.erl:230:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_users_db.erl:241:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db_updater.erl:205:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db_updater.erl:228:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_db_updater.erl:461:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_file.erl:693:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_file.erl:766:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:660:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:780:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:785:21: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:795:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:800:21: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_query_servers.erl:809:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_vhost.erl:330:18: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_password_hasher.erl:154:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_os_process.erl:72:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_os_process.erl:75:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_os_process.erl:161:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_debug.erl:560:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_debug.erl:720:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_db.erl:227:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_db.erl:307:17: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_httpd_db.erl:874:22: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:197:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:199:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:229:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:231:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:234:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:244:14: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:256:15: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:267:15: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:275:22: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:397:15: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch/src/couch_native_process.erl:438:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:84:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:128:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:140:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:152:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:167:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_event/src/couch_event_listener.erl:168:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/mem3/src/mem3_reshard_store.erl:151:17: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/mem3/src/mem3_reshard.erl:217:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/mem3/src/mem3_reshard.erl:218:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index_util.erl:36:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index_util.erl:42:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index_util.erl:51:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index_util.erl:57:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index_server.erl:372:22: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_index/src/couch_index.erl:364:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_cleanup.erl:69:30: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_index.erl:186:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_http.erl:183:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_http.erl:256:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_http.erl:682:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview.erl:381:18: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview.erl:465:20: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_util.erl:201:25: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_mrview/src/couch_mrview_show.erl:31:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_ids.erl:54:15: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_doc_processor.erl:545:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler.erl:127:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:114:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:332:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:333:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:956:19: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:976:23: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:982:21: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_scheduler_job.erl:1097:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_docs.erl:264:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_docs.erl:282:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_share.erl:127:29: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_filters.erl:112:15: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_replicator/src/couch_replicator_filters.erl:128:18: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:165:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:175:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:203:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:216:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:245:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_pse_tests/src/cpse_test_compaction.erl:262:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_tests/setups/couch_epi_dispatch.erl:74:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/ddoc_cache/src/ddoc_cache_entry.erl:165:17: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/ddoc_cache/src/ddoc_cache_entry.erl:216:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/dreyfus/src/clouseau_rpc.erl:331:27: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/dreyfus/src/dreyfus_index_manager.erl:134:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/dreyfus/src/dreyfus_httpd.erl:442:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/dreyfus/src/dreyfus_index.erl:130:27: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/nouveau/src/nouveau_util.erl:82:27: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/fabric/src/fabric_view_reduce.erl:119:21: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/fabric/src/fabric_db_create.erl:193:30: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/fabric/src/fabric.erl:198:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/fabric/src/fabric.erl:268:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/fabric/src/fabric.erl:287:9: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/mango/src/mango_httpd.erl:339:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/mango/src/mango_doc.erl:386:11: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/setup/src/setup_httpd.erl:177:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/setup/src/setup.erl:88:10: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/smoosh/src/smoosh.erl:47:13: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/smoosh/src/smoosh_server.erl:259:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/smoosh/src/smoosh_channel.erl:499:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/smoosh/src/smoosh_channel.erl:502:5: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   src/couch_scanner/src/couch_scanner_checkpoint.erl:96:17: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead.
   
   [build.txt](https://github.com/user-attachments/files/32872236/build.txt)
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead [couchdb]

Posted by "TheNetherWatcher (via GitHub)" <gi...@apache.org>.
TheNetherWatcher commented on issue #6144:
URL: https://github.com/apache/couchdb/issues/6144#issuecomment-5967724953

   Hi @nickva, I'm releasing this one. I missed the project's policy on AI-assisted contributions before I started, so I won't be sending a PR. Sorry for the noise. It's free for anyone else to pick up.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead [couchdb]

Posted by "devx-arjun (via GitHub)" <gi...@apache.org>.
devx-arjun commented on issue #6144:
URL: https://github.com/apache/couchdb/issues/6144#issuecomment-6025516851

   Hi @nickva , I'd like to work on this issue. I’m planning to start with the cases where the result of `catch ...` is ignored, as suggested above, and handle them incrementally by application/module. I’ll make sure the existing behavior is preserved and run the relevant tests before opening a PR.
   Is it okay for me to take this approach?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead [couchdb]

Posted by "TheNetherWatcher (via GitHub)" <gi...@apache.org>.
TheNetherWatcher commented on issue #6144:
URL: https://github.com/apache/couchdb/issues/6144#issuecomment-5966986922

   Hi @nickva, I'd like to take this.
   
   With OTP 29 I count at least 165 `catch ...` warnings across about 85 files, so I'd split the work. First PRs: cases where the result is ignored, rewritten as `try ... catch _:_ -> ok end`, one app per PR. Later PRs: cases where the result is used, since callers may match on `{'EXIT', ...}`.
   
   Does that work for you?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' instead [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #6144:
URL: https://github.com/apache/couchdb/issues/6144#issuecomment-5918217478

   At least in the cases where we don't care about the result (we don't do `Res = (catch ...)`) it might be amenable to an automatic parsing/replacing. `(catch ...)` to `try ... catch _:_ -> ok end`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org