LCOV - code coverage report
Current view: top level - muse/framework/languages - languageserrors.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 16 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #pragma once
      23              : 
      24              : #include "types/ret.h"
      25              : #include "translation.h"
      26              : 
      27              : namespace muse::languages {
      28              : enum class Err {
      29              :     Undefined       = int(Ret::Code::Undefined),
      30              :     NoError         = int(Ret::Code::Ok),
      31              :     UnknownError    = int(Ret::Code::LanguagesFirst),
      32              : 
      33              :     AlreadyUpToDate,
      34              :     ErrorInvalidServerLanguagesInfo,
      35              :     ErrorDownloadLanguage,
      36              :     ErrorWriteLanguage,
      37              :     ErrorLanguageNotFound,
      38              :     ErrorRemoveLanguageDirectory,
      39              :     ErrorAnotherOperationStarted,
      40              : };
      41              : 
      42            0 : inline Ret make_ret(Err e)
      43              : {
      44            0 :     int retCode = static_cast<int>(e);
      45              : 
      46            0 :     switch (e) {
      47            0 :     case Err::Undefined: return Ret(retCode);
      48            0 :     case Err::NoError: return Ret(retCode);
      49            0 :     case Err::UnknownError: return Ret(retCode);
      50            0 :     case Err::AlreadyUpToDate: return Ret(retCode, muse::trc("languages", "Up to date"));
      51            0 :     case Err::ErrorInvalidServerLanguagesInfo: return Ret(retCode, muse::trc("languages", "Error while parsing response from server"));
      52            0 :     case Err::ErrorDownloadLanguage: return Ret(retCode, muse::trc("languages", "Error while downloading language"));
      53            0 :     case Err::ErrorWriteLanguage: return Ret(retCode, muse::trc("languages", "Error while writing language files"));
      54            0 :     case Err::ErrorLanguageNotFound: return Ret(retCode, muse::trc("languages", "Language not found"));
      55            0 :     case Err::ErrorRemoveLanguageDirectory: return Ret(retCode, muse::trc("languages", "Error while removing language directory"));
      56            0 :     case Err::ErrorAnotherOperationStarted: return Ret(retCode,
      57            0 :                                                        muse::trc("languages",
      58            0 :                                                                  "Another operation on this language has already been started"));
      59              :     }
      60              : 
      61            0 :     return retCode;
      62              : }
      63              : }
        

Generated by: LCOV version 2.0-1