Commit Graph

22 Commits

Author SHA1 Message Date
Phaedrus Leeds
dbe81c90c2 common: Tweak error code docs
FLATPAK_ERROR_ALREADY_INSTALLED can be returned from, for example,
flatpak_installation_add_remote(), so document that it applies to
remotes not just apps and runtimes.
2021-02-09 09:36:59 +01:00
Alexander Larsson
df4834371a Add AUTHENTICATION_FAILED and NOT_AUTHORIZED error codes
These allow us to report more details from authenticators
2020-06-09 14:52:00 +02:00
Matthew Leeds
17660cab57 common: Minor doc fixes 2019-12-02 18:16:44 -08:00
Philip Withnall
62b0d3f4f1 common: Bump version numbers for new parental controls API
The PR was written before 1.5.0 was released, but was then merged after
1.5.0 was released — so bump the version numbers to 1.5.1.

See https://github.com/flatpak/flatpak/pull/2797.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 13:54:37 +02:00
Philip Withnall
c40223267c error: Add a ‘permission denied’ error code
This will be used for parental controls, and potentially other reasons
for denying installation of an app.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-03 10:42:04 +02:00
Matthew Leeds
c0d5f1bfc8 Add FLATPAK_ERROR_REF_NOT_FOUND
This adds a new error to FlatpakError and uses it everywhere a ref is not
found, either locally or in a remote. This should hopefully be more useful than
the status quo of either returning FLATPAK_ERROR_INVALID_DATA or
G_IO_ERROR_NOT_FOUND or something else. Technically this is an API break but it
seems worth the risk. I checked gnome-software which does not seem affected by
this, and I checked eos-updater which does check for G_IO_ERROR_NOT_FOUND in
one place that will be affected by this but we can patch that.

Closes: #2895
Approved by: matthiasclasen
2019-05-13 10:57:11 +00:00
Matthew Leeds
9a09001317 common/flatpak-error: Fix a typo
Closes: #2895
Approved by: matthiasclasen
2019-05-13 10:57:11 +00:00
Alexander Larsson
6088c7d0a1 dir: Add support for getting remote state using only caches
If only_cached is TRUE we never do any network i/o, instead
returning ERROR_NOT_CACHED if this is necessary.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Matthew Leeds
2274242301 transaction: Refuse to let root modify a user repo
If the user (erroneously) runs as root while modifying their user
installation, e.g. with "sudo flatpak --user install ...", this can
cause "permission denied" errors later on when they try to operate on
the installation as their own user. So refuse to execute a transaction
on a user-owned installation as root. Root can still operate on their
own per-user installation.

This approach does have a weakness: if flatpak is running as root when the user
installation is first created, it will be owned by root and therefore
avoid this check. I'm not sure what could be done about that.

Fixes https://github.com/flatpak/flatpak/issues/2565

Closes: #2575
Approved by: alexlarsson
2019-01-17 07:40:29 +00:00
Matthias Clasen
92b0ad5f7e Handle out-of-space errors nicer
Ostree just gives us a generic G_IO_ERROR_FAILED (boo!),
so we need to scrape the message to infer that this was
out-of-space. Translate this to an explicit error code
that we handle in the UI.

Closes: #2477
Approved by: alexlarsson
2019-01-11 13:46:31 +00:00
Matthias Clasen
56d975f8c4 Add a few more error codes
Add FLATPAK_ERROR_INVALID_DATA and use if for cases where
the incoming data for an update or install is faulty, and
add FLATPAK_ERROR_UNTRUSTED, FLATPAK_ERROR_SETUP_FAILED and
FLATPAK_ERROR_EXPORT_FAILED to cover more error conditions.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
38eebef90c Avoid flatpak_fail in ref parsing
Add an error code for invalid refs, and use it when
composing or decomposing refs.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
c284777d61 Add more api docs for libflatpak
Bring the library docs much closer to completion.

Closes: #2053
Approved by: alexlarsson
2018-09-03 10:31:51 +00:00
Matthew Leeds
fb989a62a1 common: Add and use FLATPAK_ERROR_DOWNGRADE
This will be useful in distinguishing downgrade errors from other
errors, which I'll need in the next commit.

Closes: #1965
Approved by: alexlarsson
2018-08-20 06:58:01 +00:00
Matthew Leeds
1ff0cf8c16 common: Register all FlatpakError codes as D-Bus errors
This will allow us to return anything in the FlatpakError domain using
g_dbus_method_invocation_return_gerror().

Closes: #1965
Approved by: alexlarsson
2018-08-20 06:58:01 +00:00
Alexander Larsson
50fd8aee24 Add FLATPAK_ERROR_RUNTIME_NOT_FOUND error 2018-07-10 19:26:16 +02:00
Alexander Larsson
0ac154e913 lib: Add FLATPAK_ERROR_REMOTE_NOT_FOUND error
And return it where we look up remotes.

Partial fix of #1855
2018-07-10 19:26:16 +02:00
Alexander Larsson
df3a0c444b deploy: Do required-version check on deploy too
We only checked this in transaction. This is now the recommended way to installation
via libflatpak too, but if you use the old API this check also ensures that
installation fails if the required version is too old.

Also, we add a specific error code for this so callers can check for it.

Fixes https://github.com/flatpak/flatpak/issues/881

Closes: #1755
Approved by: alexlarsson
2018-06-04 13:30:00 +00:00
Alexander Larsson
2642b55e91 libflatpak: Guard public headers for individual includes 2018-05-29 16:37:21 +02:00
Alexander Larsson
9b8024326b transaction: Move operation errors, aborting and skipping to CLI
We add an error signal to Transaction that the calle (cli) handles. It
decides what to do with the error and whether to continue or abort.

A new error ABORTED is returned from flatpak_run() to indicate
that it errored out because you chose to abort. We also add a new
error SKIPPED that we use to report that some operation is skipped
(due to earlier errors).

This also means we remote the stop_on_first_error argument
from flatpak_transaction_run() as this is now controlled by
the caller.
2018-05-29 16:37:21 +02:00
Alexander Larsson
fd846875a2 transaction: Move already-installed skip:ing to from FlatpakTransaction to CLI 2018-05-29 16:37:21 +02:00
Alexander Larsson
efb92704fe Merge lib/* into common
This moves all the files from lib into common, and it also adds all the libflatpak
sources into libflatpak-common, making libflatpak just a wrapper around the common
helper library.

This move allows the CLI to use all the code from libflatpak. We were already doing
this with a few things like flatpak-error*.[ch], and we want to do it even more
when sharing FlatpakTransaction. This also allows use to slowly move
the CLI to using the libflatpak apis for some things.

Closes: #1706
Approved by: alexlarsson
2018-05-24 11:59:52 +00:00